Bash IFS ('\n'): Problems with file name detection through find command and for loop -
#!/bin/bash ifs='\n' declare -i count=0 ax=$(find *.iso -maxdepth 1 -type f) # rather use ax="$(find *.iso -maxdepth 1 -type f"? # a="${ax%x}" < use when applying "" $() in ax? should include newlines way. edit: don't need trailing newlines fix. iso in "$ax" echo "use "$iso"? [y/n]?" # outputs files, ifs has no force somehow read choiceoffile shopt -s nocasematch case $choiceoffile in y ) echo "using selected file.";; * ) continue;; esac # sort of processing done
is command substitution done right? variable not work ifs \n in loop, don't why occurs.
for loop supposed process filenames blank space processing output of find line line (thats why use ifs \n).
the variable not work ifs \n in loop, don't why occurs.
ifs='\n'
doesn't set ifs
newline, sets ifs
literal string \n
. if want set ifs newline, use:
ifs=$'\n'
Comments
Post a Comment