I have the following file:
$ cat my_exec.sh
#!/usr/bin/env python
print(10)
It should just print 10. However, I can't get it to do so:
$ sudo ./my_exec.sh
sudo: ./my_exec.sh: command not found
$ sh my_exec.sh
my_exec.sh: line 3: syntax error near unexpected token `10'
my_exec.sh: line 3: `print(10)'
How do I run my file?
my_exec.pyand update the first line to#!/usr/bin/pythonsudomeans "super user do". Do you need your script to be executed with elevated/different permissions? If not, don't usesudo.shexecutes a shell script in POSIX-compliance mode, so you don't want that either. Have you tried./my_exec.sh?sudobecause simply doing./my_exec.shresulted in permission denied.