Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Recently it seems that shell has changed how it handles spaces in parameters. It used to handle them properly (Or at least as I intended it to), but now it recognises it as a bunch of different parameters and completely misses the escape character.

An example of a small script that used to work very well:

#!/bin/sh 
exec /home/evan/.applications/Sublime\ Text\ 2/sublime_text $1

So I would give it some filepath with spaces and it used to open the proper file eg, /home/evan/Document/My\ File\ Path/file.txt would open that file.txt. Now it opens "My", "File", "Path", and some unknown "file.txt" Obviously, that won't be the file.txt that I am looking for.

Any help would be appreciated. Thank you in advance.

OS: Ubuntu 13.04 GNOME edition with latest updates

EDIT: I forgot to mention that the command executes perfect. The parameter does not.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

That's why we use quotes.

... "$1"
share|improve this answer
    
Short answer, but straight to the point. :) I'll throw in this link which explains it more in detail mywiki.wooledge.org/Arguments –  geirha May 24 '13 at 5:43

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.