我有以下 JavaScript 脚本:
exec('(echo "<!doctype html><html><body><script>" && browserify --ig '+file+'.js '+(minify ? '| uglifyjs'+(compress ? ' -c' : '') : '')+' && echo "</script></body></html>") > '+file+'.html')
我想把它单独翻译成ShellScript。但是,如何翻译三元运算符呢?
最佳答案
要将三元运算符转换为 shell 脚本,您需要使用 if 语句。我不认为 shell 脚本有像三元运算符这样的东西。
如果您需要了解 if 语句的语法,请查看 here .
关于javascript - 如何在 shell 表达式中添加条件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18067816/