简体   繁体   English

Automator中的Shell脚本无法正常工作

[英]Shell script in Automator is not working

I've just figured out how to pass variables to a shell script in Automator thanks to this post but now the script doesn't work, when in Terminal works well. 我刚刚弄清楚如何将变量传递给Automator中的shell脚本,感谢这篇文章,但是现在脚本不起作用,当在终端中运行良好时。 I'm missing something? 我错过了什么? Tried with and without quotes. 尝试使用和不使用引号。 Btw the script is for converting audio to any format, in this case to m4r ringtones format. 顺便说一句,该脚本用于将音频转换为任何格式,在本例中为m4r铃声格式。

afconvert [original-audio-file] [ringtone-file] -f m4af

Here is screenshot of automator workflow 这是automator工作流程的屏幕截图 在此输入图像描述

You probably need to tell the shell script where afconvert is installed. 您可能需要告诉shell脚本安装afconvert位置。 So, in the Terminal, type: 所以,在终端中键入:

which afconvert

to find where it is. 找到它的位置。 Then use the full path it displays inside your script, something like this: 然后使用它在脚本中显示的完整路径,如下所示:

/usr/local/bin/afconvert "$1" "$2" -f m4af
echo $1
echo $2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM