Hello
I am getting error when the file (Folder or Application) path having space is given as external input to the shell program.
It works fine for the files which has no spaces in the file name
Thans,
Hello
I am getting error when the file (Folder or Application) path having space is given as external input to the shell program.
It works fine for the files which has no spaces in the file name
Thans,
Quote the variable or change the Internal Fieldseparator temporarily.
Regards
Hi
I tried with giving quotes, but it still giving error.
It's putting up "No such File or directory"
Till the Space it works properly, for example
Suppose I have a folder named 'Untitled Folder' on my desktop when I tried this folder path as external input it giving error as Users/Keshav/Desktop/Untitled : No such file or Directory...It is not considering the space in the folder name
Are you referring to the variables as "$1", for example? Or just "$1"?
Step 1:
Using 'read' command i entered a path such as '/Users/admin/untitled\ folder/
Step 2:
I assigned the entered path to a variable
Step 3:
I used 'cd' command to change the directory to the one stored in the variable
I got an error message saying no such file or directory since it is not taking the path entered after untitled
cd to the path using double quotes , eg cd "$dir" where dir is the variable read.