Red Hat Bugzilla – Bug 158617
Nautilus fails to open shell script files
Last modified: 2007-11-30 17:11:06 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050308 Firefox/1.0.1 Fedora/1.0.1-5
Description of problem:
I'm trying to have a shell script executed by double-clicking the file icon in GNOME's Nautilus file browser. I have the following simple shell script named tst.sh and with "+x" attributes:
echo Hello there
read -p "Hit return: " tmpvar
The default action for this file under Nautilus is "Open with Terminal", but when I double-click it or select "Open with Terminal" from its menu I just get a spinning hourglass for 30 seconds or so. If I then return to the main console screen (Ctrl-Alt-F1) I see the following warning was reported:
Invalid argument: "/home/ian/tst.sh"
If I right-click the file and select Open with EMACS that works OK. After a little bit of playing with it I've discovered:
1. If the file has a ".sh" extension or begins with the line "#!/bin/sh -f" then Nautilus recognizes it as a shell script and changes the icon to 3 cog wheels. Then if I double-click it I just get the hourglass.
2. If I rename the file to remove the ".sh" extension and delete that first line, then the icon changes to the one for a plain text file. Then if I double-click it I get the "run or display?" dialog, and if I select Run in Terminal it works OK.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create an executable shell script file beginning with the line "#!/bin/sh -f" and/or with a .sh extension.
2. Browse to the file in Nautilus and verify that in its properties the default under "Open With" is Terminal.
3. Double-click the file, or right-click it and select Open with Terminal.
Actual Results: The file does not execute. A spinning hourglass is shown for 30 seconds or so.
Expected Results: It should be executed under a terminal window.
I created the test.sh you describe, and things work for me in rawhide/FC6.