#!/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}" < Could I use this when applying "" to $() in AX? But it should already include newlines like this way. edit: I don't need the trailing newlines fix.
for iso in "$AX"
do
echo "Use "$iso"? [Y/N]?" # Outputs ALL files, IFS has no force somehow
read choiceoffile
shopt -s nocasematch
case $choiceoffile in
y ) echo "Using selected file.";;
* ) continue;;
esac
# some sort of processing
done
Is the command substitution done right? The variable does not work with the IFS \n in the for loop, I don't get why this occurs.
for loop is supposed to process filenames with blank space by processing the output of find line by line (thats why I use the IFS \n).
.isofiles but then usingfindto get the.wbfsfiles? Would it not be easier to just loop over both and count the iso files and use an array for the wbfs files and then just use array offset indexing to get the count you want?case $image in *.iso) count+=1;; *.wbfs) files+=("$image");; esacand then"${files[@]:$count}"?findcommand? You are getting a count of every iso file from the loop and then using find and limiting its output to exactly that same count?