hi to all.
I couldn't, for some reason, post an new thread in the "development" section so i posted it here. feel free to move it around
I'm new to bash scripting but i try, mainly for educational purposes, to make a script for assigning the corrected name of a file (backslashes before spaces) to a variable so it can be fed to a command line argument.
my code isn't anywhere near working!! so i would like a bit of help!
Method No.1
Method No.2Code:IFS=" " for space_file in $(find * -type f); do cool_file= IFS="\*" ### here i know i miss the correct escape char for "every char" for char_check in "$space_file"; do # echo character "$char_check" # test if [ "$char_check" = " " ]; then char_check="\ " fi cool_file=$(echo $cool_file$char_check) done echo $cool_file done unset IFS
So, is Method No.1 going to work if i set IFS to each and every character and whow do i do that?Code:IFS=" " for space_file in $(find * -type f); do cool_file= unset IFS for char_check in "$space_file"; do cool_file="$cool_file\\$char_check" # if this worked i know that i will have to "tail" out the last char. done echo $cool_file done unset IFS
and, why Method No.2 just adds a "\" in th beginning of the file???
please please help!
g.



Adv Reply


Bookmarks