I'm using the newer command, mapfile, but the principle is the same (see my thread about "lost command line options" or something of that sort).
The script:
Code:
#!/bin/bash
mapfile -t lalaland <alleylocate
file0=${lalaland[0]}
echo $file0
city=${lalaland[1]}
echo $city
sprov=$(echo ${lalaland=[2]})
echo "State is $sprov"
echo ${lalaland[2]}
exit 1
country=${lalaland[3]}
echo $country
ccode=${lalaland[4]}
echo $ccode
exiftool -fast5 -overwrite_original_in_place -P -q -City="$city" -State="$sprov" -Country="$country" -CountryCode="$ccode" "$file0"
exit 0
When run on the attached text file,
sprov and
lalaland[3] give different answers. The first consistently returns the file name [array item 0] while echoing
lalaland3 returns the proper array item (California, in this case).
But it's the 0 line (filename) that's written as "State" by exiftool, and of course I don't want or need that. Am I missing something? Is something out of order?
Carver
PS:The name of the attached file was changed to comply with LQ's file validity requirements. When I run the script I use the same text file without the DOS extension, as it appears in the script