![]() |
2011-01-04
, 10:20
|
Posts: 992 |
Thanked: 738 times |
Joined on Jun 2010
@ Low Earth Orbit
|
#2
|
The Following User Says Thank You to kureyon For This Useful Post: | ||
![]() |
2011-01-04
, 11:13
|
Posts: 162 |
Thanked: 25 times |
Joined on Dec 2009
|
#3
|
The Following User Says Thank You to paai For This Useful Post: | ||
![]() |
2011-01-04
, 11:23
|
Posts: 28 |
Thanked: 14 times |
Joined on Sep 2010
|
#4
|
The Following User Says Thank You to littlebadger For This Useful Post: | ||
![]() |
2011-01-04
, 13:41
|
|
Posts: 330 |
Thanked: 483 times |
Joined on Dec 2010
@ Norwich, UK
|
#5
|
![]() |
2011-01-04
, 15:14
|
Posts: 6 |
Thanked: 7 times |
Joined on Jan 2010
|
#6
|
![]() |
2011-01-04
, 15:45
|
|
Posts: 330 |
Thanked: 483 times |
Joined on Dec 2010
@ Norwich, UK
|
#7
|
Are line endings in the script correct? If you created the script on windows, chances are lines end on CR-LF instead of LF only, and the shell will include that CR character at the end of the command it parses. I'm pretty sure the directory you want to cd to doesn't have a CR character in its name.
![]() |
2011-01-04
, 15:46
|
Posts: 162 |
Thanked: 25 times |
Joined on Dec 2009
|
#8
|
![]() |
2011-01-04
, 16:02
|
Posts: 6 |
Thanked: 7 times |
Joined on Jan 2010
|
#9
|
The Following 2 Users Say Thank You to fgevaerts For This Useful Post: | ||
![]() |
2011-01-04
, 17:01
|
|
Posts: 330 |
Thanked: 483 times |
Joined on Dec 2010
@ Norwich, UK
|
#10
|
It wouldn't say "can't cd to /whatever/directory" then.
FRuMMaGe: Can you run "od -c yourscript.sh", and check that there are indeed only \n characters for line ending, and no \r?
The "can't cd to /whatever/directory" error is printed if you do have this wrong, which is why I wouldn't rule out this possibility without seriously checking.
I'm trying to load a simple bash script that cd's to a directory and executes a function, but whenever I sh the script, it ALWAYS tells me "can't cd /whatever/directory" (obviously this is not the actual directory)
For debugging purposes, I have set the directory name to things that DEFINITELY exist, such as /home/user/MyDocs/
I have run the command by itself in xterm with no problems, but it gets picky when I run it from a script.
I have chmod +x it and everything is as it should be. What the hell is wrong?
OMNOM: Pacman-like game now in extras-devel
fAircrack (Aircrack GUI): Point-and-click pwnage for your N900
Now with John the Ripper integration