Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I wrote the following

#!/bin/bash
cd ~/bin/red5-1.0.0
gnome-terminal --working-directory=. -x red5.sh

red5.sh is the script to run (this is java written media server).

My script above opens new terminal but with error message

There was an error creating the child process for this terminal
Failed to execute child process "red5.sh" (No such file or directory)

What can be the cause? I am at Ubuntu 11.10

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The working directory does not affect your $PATH1, thus I guess what's happening can be understood if you do the same thing in a terminal, i.e.

$ cd ~/bin/red5-1.0.0
$ red5.sh

will not work either; what does work is one of the following:

$ cd ~/bin/red5-1.0.0
$ ./red5.sh            # note the relative path to the script

or

$ cd ~/bin/red5-1.0.0
$ export PATH=~/bin/red5-1.0.0:$PATH   # add the path to $PATH which is where 
$ red5.sh                              # the shell looks for red5.sh

So, guessing that gnome-terminal works similar (regarding where it looks for executables), you could probably alter your script in one of these ways, too.

1: If your $PATH does not contain ., as Kevin pointed out (How about other relative paths, btw?).

share|improve this answer
    
Great! This was a mistake! –  Dims Nov 30 '12 at 10:30
1  
But this solution will run the script waiting until it ends. He wants it not to wait, so the & symbol should be appended at the end of the running command. –  Onturenio Nov 30 '12 at 10:53
1  
Just a note, "The working directory does not affect your $PATH". This isn't always true. Some people have the current directory (export PATH=.:/usr/local/bin:...) in which case the effective PATH will differ based on the directory you are in. –  Kevin Cox Nov 30 '12 at 16:59
    
Ha, right. Thanks, added a note. –  sr_ Nov 30 '12 at 22:15

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.