Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想这样做bash -c '<some smart bash script>'会输出传递给-c的实际字符串。
bash -c '<some smart bash script>'
换句话说,如果SCRIPT设置为该智能脚本,bash -c "$SCRIPT"则应该产生$SCRIPT.
SCRIPT
bash -c "$SCRIPT"
$SCRIPT
那可能吗?如果是,如何?
谢谢
看man bash
man bash
5.2 Bash 变量 ... BASH_EXECUTION_STRING -c 调用选项的命令参数。
如果你试试
bash -c 'echo $BASH_EXECUTION_STRING'
它会给你
回声 $BASH_EXECUTION_STRING