Linux shell script shebang env All In One
Linux shell script shebang env All In One
指定 shell script 的运行环境
shell script shebang
env
hash bang env
#!\usr\bin\env bash
❌
#!\usr\bin\env bash
# ❌
#!/usr/bin/env
✅
#!/usr/bin/env bash
✅
demos
#!/usr/bin/env bash
# ✅
export N=1
# case 1 数字
# suceess exit ✅
# ✅
case "$N" in
1)
echo 'case 1 数字';;
2)
echo 'case 2 数字';;
*)
echo 'default case 数字 *'
echo 'error exit ❌'
exit 1
;;
esac
echo 'suceess exit ✅'
exit 0
(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
#!/usr/bin/env bash
vs #!/usr/bin/bash
vs #!/bin/bash
The Difference Between #!/bin/bash
and #!/usr/bin/env bash
The Difference Between #!/usr/bin/bash
and #!/usr/bin/env bash
https://www.baeldung.com/linux/bash-shebang-lines
refs
https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
https://stackoverflow.com/questions/43793040/how-does-usr-bin-env-work-in-a-linux-shebang-line
https://www.baeldung.com/linux/bash-shebang-lines
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/17369184.html
未经授权禁止转载,违者必究!