And close behind that, ANOTHER bad script
by L_Carver from LinuxQuestions.org on (#5AF95)
This script Code:#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
tref="Topless Treats""
cate=PRN
pic=0
function oliverhardy () {
echo -e "What list file will I be using?"
read -e thelist
if [[ "$thelist" =~ " " ]]; then
fg=${thelist% *}
else
fg=$thelist
fi
}
oliverhardy
while read fg
do
echo -e "Working on item '$fg' now."
exiv2 --keep -M"set Iptc.Application2.TransmissionReference $tref" -M"set Xmp.photoshop.TransmissionReference $tref" "$fg"
echo -e "TRANSMISSION REFERENCE = $tref"
exiv2 --keep -M"set Iptc.Application2.Category $cate" -M"set Xmp.photoshop.Category $cate" "$fg"
echo "CATEGORY = $cate"
pic=$[pic+1]
done<$fg
echo -e "$pic files annotated \(category PRN\) this run." returns the following errorsCode:/home/carver/bin/holyrefer/treftopl: line 28: unexpected EOF while looking for matching `"'
/home/carver/bin/holyrefer/treftopl: line 29: syntax error: unexpected end of fileAnd with line 25 changed to Code: echo "CATEGORY = $cate"...my installed ShellCheck returns Code:In /home/steve/bin/holyrefer/treftopl line 29:
^-- SC1072: Expected end of double quoted string. Fix any mentioned problems and try again.Some of this code works fine in similar scripts I've written. Why is it buggy here?
Carver
Attached Files


SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
tref="Topless Treats""
cate=PRN
pic=0
function oliverhardy () {
echo -e "What list file will I be using?"
read -e thelist
if [[ "$thelist" =~ " " ]]; then
fg=${thelist% *}
else
fg=$thelist
fi
}
oliverhardy
while read fg
do
echo -e "Working on item '$fg' now."
exiv2 --keep -M"set Iptc.Application2.TransmissionReference $tref" -M"set Xmp.photoshop.TransmissionReference $tref" "$fg"
echo -e "TRANSMISSION REFERENCE = $tref"
exiv2 --keep -M"set Iptc.Application2.Category $cate" -M"set Xmp.photoshop.Category $cate" "$fg"
echo "CATEGORY = $cate"
pic=$[pic+1]
done<$fg
echo -e "$pic files annotated \(category PRN\) this run." returns the following errorsCode:/home/carver/bin/holyrefer/treftopl: line 28: unexpected EOF while looking for matching `"'
/home/carver/bin/holyrefer/treftopl: line 29: syntax error: unexpected end of fileAnd with line 25 changed to Code: echo "CATEGORY = $cate"...my installed ShellCheck returns Code:In /home/steve/bin/holyrefer/treftopl line 29:
^-- SC1072: Expected end of double quoted string. Fix any mentioned problems and try again.Some of this code works fine in similar scripts I've written. Why is it buggy here?
Carver
Attached Files
![]() | treftopl.txt (681 Bytes) |