Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    I've seen the "$@" command but wasn't sure how to use it. I simply put "cd $@" at the beginning of my script and it solved the problem. Thanks for your help. Commented Mar 1, 2011 at 21:27
  • 1
    Actually, I'd recommend using cd "$1" instead. $@ expands to the list of all arguments passed to the script, and if there's more than one cd will just gripe that it can't go more than one place; $1 expands to the first argument, so if you manage to pass it more than one it'll just go with the first. Also, make sure you use double-quotes around it, to keep the shell from getting confused by funny characters (like spaces) in the folder path. Commented May 7, 2011 at 15:42
  • 1
    @Gordon In this case, with the "Allow Multiple Selection" checkbox unchecked, there will actually never be more than one argument passed to the shell script. Putting $@ in double quotes is indeed necessary (as I did in my original answer). Commented May 10, 2011 at 10:44