1
这是一个zsh特定脚本,稍后我会担心bash(即从不)。zsh - 从shell脚本中获取命令历史记录
这是我到目前为止。
#!/home/slu/.zsh/bin/zsh
# This is a shellscript generator that converts a history entry to a script
set -e
if [[ $2 =~ [0-9]+ ]]
then
cmd= !$2
echo "first arg is $1 and command is $cmd"
else
echo "Invalid 2nd arg"
exit 1
fi
这显然是行不通的,因为它看起来该命令!33
当我通过它33
作为第二ARG。
换句话说, bash的history -p
的等效zsh是什么?
如何让脚本扩展它?