How can I cd into a dir, when it contains spaces, and I need to use it in a script?
the directory: /home/user/this is a folder/something
normally I would use: cd /home/user/this\ is\ a\ folder/something/
but in a script I cant just add the "" like:
find . -type d | while read FOLDER; do cd $FOLDER; done $ No such file or directory
the problem is, that there would be more "special chars" then spaces, "sed" them all? :D
Thank you
On Thu, May 21, 2009 at 2:40 PM, Michael Casey michaelcasey73@gmail.com wrote:
How can I cd into a dir, when it contains spaces, and I need to use it in a script?
the directory: /home/user/this is a folder/something
normally I would use: cd /home/user/this\ is\ a\ folder/something/
but in a script I cant just add the "" like:
find . -type d | while read FOLDER; do cd $FOLDER; done $ No such file or directory
find . -type d | while read FOLDER; do cd "$FOLDER"; done
should do the trick...
How can I cd into a dir, when it contains spaces, and I need to use it
in a script?
Quote it:
cd "/home/user/this is a folder/whatever"
-Rob
********************************************************************** This communication contains information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), disclosure, copying, distribution, or other use of, or action taken or omitted to be taken in reliance upon, this communication or the information in it is prohibited and maybe unlawful. If you have received this communication in error please notify the sender by return email, delete it from your system and destroy any copies. **********************************************************************
yeah, SOLVED: :))
clear; find . -type d | while read FOLDERNAME; do $(cd "$FOLDERNAME"); done
Thank you!!