Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm new to OSX, and don't use the commandline that often. I'm trying to use a script to do some automatic deployment, but when I execute the script it is looking for a directory.

I tried:

sh myscript.sh '/Users/profiles/Desktop/Development'
sh myscript.sh /Users/profiles/Desktop/Development
sh myscript.sh -/Users/profiles/Desktop/Development

but I keep getting "No Such file or directory". What is the proper way to do this?

I know this is a basic question, but I can't seem to find a simple answer. Everything I find on google is much more advanced..

UPDATE: In the script, it's looking for the path like this:


if [ -z $DIR_DEVELOP ]; then
    echo "Syntax: myscript.sh <destination>"
    exit 1
share|improve this question
Also, what's in your shebang line ( en.wikipedia.org/wiki/Shebang_(Unix) )? –  msanford Apr 2 '12 at 13:34
looks like "!#/bin/bash –  cinqoTimo Apr 2 '12 at 14:54
Then you don't need to pass the script to sh (which is itself a shell) at all as the purpose of the shebang line is to choose an interpreter for the script. Assuming the script has the execute bit set, you can call it like ./myscript.sh '/Users/profiles/Desktop/Development'. –  msanford Apr 2 '12 at 15:13
Perhaps another good question for us to ask of you would be Please show us what your script does when it looks for the path you pass, because the bug is probably there. I should have started with that question :) –  msanford Apr 2 '12 at 15:16
@msanford - This is a script that has been in operation for a while, so I know it's not the script, it's me... –  cinqoTimo Apr 2 '12 at 17:03

2 Answers 2

You have to enable tracing in bash:

bash -x myscript.sh '/Users/profiles/Desktop/Development'

You will see the "No Such file or directory" message right after the line that generates the error.

share|improve this answer
I ran that line and got the same thing... –  cinqoTimo Apr 2 '12 at 14:56
It is the same output? Or the same error? –  Mircea Vutcovici Apr 2 '12 at 18:29
Same exact output - just says "No Such File or Directory" –  cinqoTimo Apr 2 '12 at 19:34
Before the error can you see commands from the script? Is the partition mounted with no-exec? –  Mircea Vutcovici Apr 2 '12 at 19:59

You don't need to use ' in your path. According to the Advanced Bash Scripting guide:

Same as $*, but each parameter is a quoted string, that is, the parameters are passed on intact, without interpretation or expansion. This means, among other things, that each parameter in the argument list is seen as a separate word.

So the path your script is trying to access is literally '/Users/profiles/Desktop/Development' instead of /Users/profiles/Desktop/Development

share|improve this answer

Your Answer


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.