我正在使用 bash 4.3.11(1) 并安装了以下历史插件(通过.bash_it):
# enter a few characters and press UpArrow/DownArrow
# to search backwards/forwards through the history
bind '"^[[A":history-search-backward'
bind '"^[[B":history-search-forward'
Run Code Online (Sandbox Code Playgroud)
当我登录到交互式会话时一切正常,但是当我通过ssh host 'ls -als'
例如运行远程命令时,我看到以下输出:
: ssh host 'ls -als'
/home/ubuntu/.bash_it/plugins/enabled/history.plugin.bash: line 3: bind: warning: line editing not enabled
/home/ubuntu/.bash_it/plugins/enabled/history.plugin.bash: line 4: bind: warning: line editing not enabled
Run Code Online (Sandbox Code Playgroud)
当我echo -e '\0033\0143'
在每次绑定调用后修改历史插件时,我不再收到警告,但我的控制台已被清除。不是一个巨大的缺点,但知道一种更简洁的方法来抑制远程命令的这种情况会很好。
# Works, but annoyingly clears console
# enter a few characters and press UpArrow/DownArrow
# to search backwards/forwards through the history …
Run Code Online (Sandbox Code Playgroud) 我很好奇 Chrome 中是否有类似的技术可以像在 Firefox 中那样进行地址栏参数字符串替换。如果您创建一个书签并在书签 URL/地址部分放置一个 %s,并为该书签设置一个关键字,您可以执行以下操作
URL: http://php.net/%s
Keyword: php
Type in browser: php fopen
End up at: http://php.net/fopen
Run Code Online (Sandbox Code Playgroud)
这是进入 Chrome 还是有办法做到这一点?
我在 npm 脚本中有一个命令,它通过 SSH 连接到远程构建服务器并运行 Bash 脚本。该脚本设置一个锁文件,并trap
在脚本退出时调用以删除该锁文件。
在这两种情况下,我都用ctrl+取消操作C。
LOCKFILEPATH="/tmp/env_app.lock"
# cleanup function just deletes $LOCKFILEPATH
function mutex() {
if [ -f "$LOCKFILEPATH" ]; then
echo -e "\n\n${redtext}Build already in progress! Exiting.${resettext}\n\n";
exit 1;
else
touch $LOCKFILEPATH;
trap cleanup EXIT;
fi
}
Run Code Online (Sandbox Code Playgroud)
当您第一次通过 SSH 进入主机以运行它时,这可以正常工作,但是当您通过 SSH 发送命令时,陷阱不起作用
ssh hostname command
Run Code Online (Sandbox Code Playgroud)
我尝试添加到 trap 命令以运行更多信号,但这些似乎也不起作用:
trap cleanup EXIT SIGHUP SIGKILL SIGTERM SIGINT
Run Code Online (Sandbox Code Playgroud)
我应该在这里做什么?
我还设置了一个更简单的脚本,当通过 SSH 手动执行它时,它似乎工作正常。也许当我使用 npm 脚本运行它时添加了层?npm 脚本是:
"deploy": "ssh HOSTNAME ''deploy-script $(git rev-parse …
Run Code Online (Sandbox Code Playgroud) 我通过自制程序安装了 gpg。
我有一个 ~/gpg-agent.conf 文件如下:
allow-preset-passphrase
default-cache-ttl 1209600
max-cache-ttl 1209600
max-cache-ttl-ssh 1209600
Run Code Online (Sandbox Code Playgroud)
我的 .bashrc (实际上:)~/.bash_it/custom/gpg-agent.bash
有
export GPG_TTY=$(tty)
[ -f ~/.gpg-agent-info ] && source ~/.gpg-agent-info
if [ -S "${GPG_AGENT_INFO%%:*}" ]; then
export GPG_AGENT_INFO
else
eval $( /usr/local/bin/gpg-agent --daemon --write-env-file ~/.gpg-agent-info )
fi
Run Code Online (Sandbox Code Playgroud)
我的假设是这样可以使我每 2 周只被要求输入一次密码,但仍然每 5 分钟被要求输入一次。gpg-agent --gpgconf-list
显示正在使用的实际值?
$ gpg-agent --gpgconf-list
gpgconf-gpg-agent.conf:16:"/Users/notbrain/.gnupg/gpg-agent.conf
verbose:8:
quiet:8:
debug-level:24:"none:
log-file:8:
default-cache-ttl:24:600:
default-cache-ttl-ssh:24:1800:
max-cache-ttl:24:7200:
max-cache-ttl-ssh:24:7200:
enforce-passphrase-constraints:8:
min-passphrase-len:24:8:
min-passphrase-nonalpha:24:1:
check-passphrase-pattern:24:
max-passphrase-days:24:0:
enable-passphrase-history:8:
no-grab:8:
ignore-cache-for-signing:8:
no-allow-mark-trusted:8:
no-allow-external-cache:8:
disable-scdaemon:8:
enable-ssh-support:0:
Run Code Online (Sandbox Code Playgroud)
为什么我的 gpg-agent.conf 文件没有被遵守?我缺少什么?通过自制软件安装: …
bash ×3
ssh ×2
address-bar ×1
encryption ×1
gnupg ×1
gpg-agent ×1
linux ×1
shell ×1
shortcuts ×1
url ×1