Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 多个引号内的Shell脚本变量_Bash_Shell_Applescript - Fatal编程技术网

Bash 多个引号内的Shell脚本变量

Bash 多个引号内的Shell脚本变量,bash,shell,applescript,Bash,Shell,Applescript,我正在shell脚本中运行以下行: osascript -e 'tell application "System Events" to keystroke "$1"' 我希望能够使用applescript键入$1。有没有办法让1美元变成我在脚本之后输入到终端的东西?现在,它只是按字面意思键入$1。将它们放在单引号中,如下所示- osascript -e 'tell application "System Events" to keystroke '$1'' 哇!如果我执行类似于“告诉应用程序

我正在shell脚本中运行以下行:

osascript -e 'tell application "System Events" to keystroke "$1"'

我希望能够使用applescript键入$1。有没有办法让1美元变成我在脚本之后输入到终端的东西?现在,它只是按字面意思键入$1。

将它们放在单引号中,如下所示-

osascript -e 'tell application "System Events" to keystroke '$1''

哇!如果我执行类似于“告诉应用程序”系统事件的操作来击键“$1”,效果最好。是的,“$1”将引用您的输入参数。如果这是你需要的,那么你也可以使用它。