Register
It is currently Sat Oct 25, 2014 6:39 am

cd in BASH script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed Mar 23, 2011 9:31 am   

Joined: Fri Feb 11, 2011 2:03 pm
Posts: 4
I'm making a simple script to start up my minecraft server manager in a screen session, wait for it to boot, then kill the actual server. That part works, but the change directory command keeps throwing an error:

Code:
: No such file or directoryt.sh: line 1: cd: /Users/xxxx/Documents/McMyAdmin


The directory is real, and the same cd command copied into a terminal window works just fine. Any ideas? For reference, I'm on OSX 10.6.

Code:
#!/bin/sh
# minecraft.sh
#
#
cd '/Users/xxxx/Documents/McMyAdmin'
screen -AmdS minecraft mono McMyAdmin.exe
sleep 75
screen -S minecraft -X stuff $'stop\n'


Top
 Profile  
 PostPosted: Wed Mar 23, 2011 1:45 pm   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
kaivanes wrote:
but the change directory command keeps throwing an error:
Code:
: No such file or directoryt.sh: line 1: cd: /Users/xxxx/Documents/McMyAdmin

If you look at the error it's all 'mangled up'. The message 'no such file or directory' should be behind the actual directory name like: /non/existing/directory: No such file or directory
So this looks to me like the directory name in your script, actually has some (MS-DOS?) newline at the end. Since computers are stupid, it will try to cd to a directory with a newline in it...
This of course is just a hunch.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP