Last active
August 29, 2015 14:05
-
-
Save tylergaw/6a24da1bbb0716513cc2 to your computer and use it in GitHub Desktop.
Passing quoted string of directory name as an argument
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I'm calling the shlelfish.sh script below from Objective-C's NSTask. It has an arguments property. That property is an Array. I need to include | |
| the name of a directory in that array and it needs to be a string; single or double-quoted. When the string of the directory | |
| name is passed to the script it seems like it's equivilent to the following: | |
| ./shelfish.sh "~" | |
| ls: ~: No such file or directory | |
| Each time I try with either ls or cd or the command I actually need to run which requires a directory it fails with the same error. | |
| Is there a good way to strip the quotes or am I just trying to do something bone-headed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Shell Script attempts to display list the contents of the first argument given | |
| ls $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also isn't the actual script. Just wanted to get it down to the smallest example possible.