我想从一个bash shell脚本运行一个命令,该脚本在单引号和变量中有单引号和一些其他命令.
例如 repo forall -c '....$variable'
在此格式中,$
进行转义并且不扩展变量.
我尝试了以下变化,但他们被拒绝了:
repo forall -c '...."$variable" '
repo forall -c " '....$variable' "
" repo forall -c '....$variable' "
repo forall -c "'" ....$variable "'"
Run Code Online (Sandbox Code Playgroud)
如果我用值代替变量来执行命令就好了.
请告诉我哪里出错了.