在 shebang 中使用 sudo 似乎完全被破坏了。下面的代码:
#!/usr/bin/sudo /bin/bash
echo "this should work"
Run Code Online (Sandbox Code Playgroud)
在 Ubuntu 上工作正常,但在 OSX 上给我:
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the
'nosuid' option set or an NFS file system without root privileges?
Run Code Online (Sandbox Code Playgroud)
有什么想法如何让它发挥作用吗?
注意: sudo 工作得很好,否则:
/usr/bin/sudo echo "This works"
Password:
This works
Run Code Online (Sandbox Code Playgroud)