0

I'm using Linux debian 4.9.0-kali4-amd64 #1 SMP Debian 4.9.30-1kali1 (2017-06-06) x86_64 GNU/Linux and want to make /home/pantheon/Desktop/pycrust-20170611-2151.sh run in terminal when I klick on it. The file is written in python,

#!/bin/env python import os os.system("cd /home/pantheon/Desktop/fluxion") os.system("sudo ./fluxion")

I have tried with

chmod +x /home/pantheon/Desktop/pycrust-20170611-2151.sh and chmod u+x <"">

To execute in terminal, ./home/pantheon/Desktop/pycrust-20170611-2151.sh, which gives me the error bash: ./home/pantheon/Desktop/pycrust-20170611-2151.sh: No such file or directory.

/home/pantheon/Desktop/pycrust-20170611-2151.sh gives me the output bash: /home/pantheon/Desktop/pycrust-20170611-2151.sh: /bin/env: bad interpreter: No such file or directory. (Overlined text as it is not what I want to do. I do not know about the errors, though).

I also have tried to tweak Nautilus, but that didn't help me either, as executing the file in terminal that way results in a There was an error creating the child process for this terminal. Failed to execute child process "/home/pantheon/Desktop/pycrust-20170611-2151.py" (No such file or directory)

I have done this.

sudo ls -l /home/pantheon/Desktop/pycrust-20170611-2151.sh gives me the output -rwxr-xr-x 1 pantheon pantheon 103 Jun 11 23:02 /home/pantheon/Desktop/pycrust-20170611-2151.sh

I have looked on many other forums, but have not found an answer to my problem. I think the most easy thing to do is to just ask you for help. For example, I did either not understand or get any help from the following questions: How to automatically “Run in Terminal” for script in CentOS linux, https://stackoverflow.com/questions/19509911/how-to-make-python-script-executable-when-click-on-the-file, https://askubuntu.com/questions/138908/how-to-execute-a-script-just-by-double-clicking-like-exe-files-in-windows and so on.

I know, I can open terminal and just run it as a .py file, but that is not what I want to do. I want it to run automatically in the terminal when klicking on the .sh (or .py) file.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Andreas
  • 109

1 Answers1

2

You need to use

#!/usr/bin/env python

as your shebang (note the /usr).

Stephen Kitt
  • 434,908