Was wondering if someone can take the time to explain the following:
I have a directory of files (PDF), which I place into an array.
shopt -s nullglob # Set array to 0 is nothing found=
declare -a TotalFiles=($Prefix*.pdf) # Current listing of files
TotalFileCount=${#TotalFiles[@]}
In my mesting the array contains the following.
Array Contents Scan-0030.pdf Scan-0140.pdf Scan-0005.pdf Scan-0006.pdf Scan-0007.pdf Scan-0008.pdf Scan-0009.pdf Scan-0010.pdf
I have created a the following functions to derive the next file to create
function NextNum {
HighestNum =0
echo "NextNumber Functions"
#for index in "${TotalFiles[*]}"
for file in ${!TotalFiles[*]}
do
#printf "%4d: %s\n" $index $TotalFiles ${array[$index]}
echo $file ${TotalFiles[$file]}
name=${TotalFiles[$file]}
name=${name//[^0-9]/}
name=$((10#$name))
echo "File number in name - $name"
echo $file
TotalFiles[$file]=$name
**((name > HighestNum)) && HighestNum=$name**
done
}
My question is with this line in the function which i found by googleling.
((name > HighestNum)) && HighestNum=$name
How come one does not have to specify that two variables are being compared? like this,
(($name > $HighestNum)) && HighestNum=$name
thank you for the assistance.