Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

GUI:
I changed the permissions of an sh file, so that I can read, write and execute it. I double-clicked it, selected run in Shell / terminal (whichever appears in english), but it didn't run. I double-clicked it, selected run, but it didn't run.

Command-Line:
bash *filename* runs it
sh *filename* runs it

The file content is:

#!/bin/bash

# get dirsyncpro home
DIRSYNCPRO_HOME="$(dirname $0)"

# start programm and pass any parameters
java -Xmx512M -jar "$DIRSYNCPRO_HOME/dirsyncpro.jar" $* 

Works in this person's computer:

http://www.knowliz.com/2008/08/how-to-installrun-sh-file-in-linux.html

What's going on?

share|improve this question

4 Answers 4

Your test is wrong, you must be able to run it without first calling another shell.

./my_little_script.sh

And not

bash my_little_script.sh

Also double check that the permissions actually is correct.

chmod 755 my_little_script.sh
share|improve this answer

Your problem is that when you try to run your shell script by double clicking it, your system by default will run it in your home directory.

When arriving at the line

# start programm and pass any parameters
java -Xmx512M -jar "$DIRSYNCPRO_HOME/dirsyncpro.jar" $* 

The DIRSYNCPRO_HOME folder is not the folder you expect, your jar file is not found and the application will silently stop. I think if you hardcode the value of DIRSYNPRO_HOME you should be able to run your shell script with doubleclicking it.

share|improve this answer

In Ubuntu, "Terminal" doesn't really exist. On my install (9.10) I get this:

The program 'Terminal' is currently not installed. You can install it by typing: sudo apt-get install terminal.app Terminal: command not found

I'm not sure if that is the case for you, but if it is try changing the select from "Termianl" to "gnome-terminal".

share|improve this answer
2  
i think "Terminal" in this context is a Gnome/freedesktop capability, not a specific application. similar to Apt's concept of virtual packages, gnome-terminal and urxvt and other packages "provide" the Terminal capability. my karmic VM is currently offline but i think such capabilities are defined in the *.desktop files under /usr/share/applications or similar. –  quack quixote Apr 15 '10 at 3:20
    
Terminal in brazilian porguese may be Shell in american english. It's where you type Linux commands. –  Delirium tremens Apr 15 '10 at 14:04
1  
@Delirium: no, shell is something different. terminal is what displays the output of command-line programs; shell is what provides and interprets the command-line. gnome-terminal and PuTTY are terminals; bash and tcsh are shells. where you type linux commands generally includes both a shell and a terminal. –  quack quixote Apr 15 '10 at 14:10
    
Googling for double click sh results in "I could run the script from terminal." - linuxforums.org/forum/redhat-fedora-linux-help/… "You'd run in in a terminal." - ubuntuforums.org/archive/index.php/t-1107371.html "Its intended to be used through terminal:" - cerebrux.comli.com/2clickupdate/english-version "how can I make it so that it runs in a terminal" - linuxquestions.org/questions/linux-general-1/… People are using Terminal all the time. How come it's wrong? –  Delirium tremens Apr 15 '10 at 14:19
1  
@Delirium: they're just two closely related, but distinctly different things. the terminal gives you a window to run the shell in; the shell interprets your command and runs other programs; the terminal displays what those programs output. –  quack quixote Apr 15 '10 at 14:38
up vote 0 down vote accepted

The dirsyncpro readme says that it must be run by command-line in all non-Windows operating systems. I was avoiding running the jar file, but there's no other way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.