これは zsh 固有のスクリプトです。後で bash について心配します (つまり、決して)。
これが私がこれまでに得たものです。
#!/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
2番目の引数として!33
渡すときにコマンドを探すので、これは明らかに機能しません。33
言い換えれば、 bash に相当する zsh は何history -p
ですか?
スクリプトを展開する方法は?