我有一个快速的问题
我有一个posix shell,但是我需要运行一个bash命令。
root@home:~# sh
# /bin/bash /bin/ls
然而,当我这样做时,我得到
/bin/ls: /bin/ls: cannot execute binary file
我肯定我错过了一些简单的东西,但我不确定它是什么。任何帮助吗?
使用-c参数指定您希望由另一个shell运行的命令:
" -c从command_string操作数中读取命令"
bash -c "ls"
我想出了一个变通办法
echo '#!/bin/bash--comamnd--; chmod ugo+x /tmp/script.sh; /tmp/script.sh