1

i'm writting a list of commands within an Atom plugin, one of the commands changes the terminals working directory.

However my issue is that if there is a space within the URL it will not work, it gets the directory location from the current working path, so I can't back slash the spaces manually.

You can set variables within the terminal, so is there a way to replace the spaces and back slash them within a terminal command?

** Edit: ** I get the following error code:

The files /Users/imac/Dropbox/_themev2-folder-1157, /Users/imac/WE, /Users/imac/FINANCE, /Users/imac/POOR, and /Users/imac/CREDIT do not exist.

This is the code, %(project.root) get's replaced with the project file path.

"command": [
  "pkill -9 gulp",
  "echo 'Quit: Gulp process terminated!'",
  "echo 'Start: New gulp process started, please wait...'",
  "open %(project.root)",
  "cd \"%(project.root)\"",
  "gulp"
]

** Edit 2 ** Quotes work now. Please add as an answer.

2
  • 2
    Put double quotes round the items, like this "url with spaces" and if that doesn't work, please show your code. Commented Nov 5, 2016 at 18:37
  • @MarkSetchell see edit. Commented Nov 7, 2016 at 8:21

1 Answer 1

2

As an alternative to backslash escaping troublesome characters (such as spaces) you can enclose the entire path/parameter in double quotes, so you might use:

someCmd "/path with space/file with space.txt"

rather than

someCmd /path\ with\ space/file\ with\ space.txt
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.