要将字符串变量回显到Bash中,可以使用Automator和AppleScript来完成。下面是一种解决方法,包含代码示例:
on run {input, parameters}
set myString to "Hello, World!"
do shell script "echo " & quoted form of myString
return input
end run
这个脚本在AppleScript中创建了一个字符串变量myString
,然后使用do shell script
命令将其传递给Bash的echo
命令。最后,脚本将输入返回给Automator。
您可以将myString
变量更改为您想要回显的任何字符串。当您运行这个Automator工作流时,它将在Bash中回显该字符串。
希望这个解决方法对您有所帮助!