M HYPE SPLASH
// general

Shell not handling escape character spaces

By Emma Payne

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.

1 Answer

That's why we use quotes.

... "$1"
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy