我可以使用 xdotool 键 "ctrl+x" 在从 git 拉动时退出 nano 而 运行 是 shell 脚本吗?

Can I use xdotool key "ctrl+x" to exit nano when it pops up while pulling from git whilst running a shell script?

我有一个 update.sh 当然是从 git 中提取的。问题是 nano 与 MERGE_MSG 一起弹出,我只想使用 xdotool 或其他东西退出。有没有我可以添加到 git pull origin branchName --flag 的标志? 我试过了: xdotool 键“ctrl+x” xdotool keydown "ctrl+x" xdotool keyup "ctrl+x"

在您的更新脚本中,提供 --no-edit 选项,git pull --no-edit。或在其环境中提供 GIT_EDITOR=true,如 GIT_EDITOR=true git pull 或导出它,如果你想关闭由脚本运行的 git 命令启动的所有编辑器。