[Abcde-users] http://www.shellcheck.net/

Roger rogerx.oss at gmail.com
Sun Mar 29 05:11:25 BST 2015


> On Sat, Mar 28, 2015 at 03:33:19PM -0500, Charles Steinkuehler wrote:
>On 3/28/2015 2:40 PM, Roger wrote:
>> For the fun of it, I decided to use http://www.shellcheck.net/ for checking 
>> abcde.
>> 
>> There were some surprises, some known unquoted variables, and then some really 
>> not so bright command sequences for which I said, "I thought that was odd!"  
>> (Or they were just the old Bourne Shell method.)
>> 
>> The more surprising error was the quoting error at Line #3217
>> 
>> OUTPUTFORMAT='${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
>
>It's been a long time since I looked at the abcde code, but I'm pretty
>sure that's intentional.  The quoting is to protect the string against
>expansion until it's actually used, which is after the variables are
>assigned for a particular track.  If you evaluate the variables at this
>point in the code, none of the variables have their correct values yet.
>
>> For those of you curious, you can easily check this problem by doing the 
>> following within a Bash shell:
>> 
>> $ echo $HOSTNAME
>> localhost.local
>> 
>> $ echo '$HOSTNAME'
>> $HOSTNAME
>
>No, it's used more like so:
>
>$ X='$HOSTNAME'
>$ HOSTNAME=my_machine
>$ echo $X
>$HOSTNAME
>$ eval echo "$X"
>my_machine
>
>You can do lots of fun indirection with eval.  :)


I tend to agree to, as I followed the shellcheck.net's recommendations on one 
of my scripts that I intentionally used single quotes (etc), and following the 
recommendation broke the variable expansion.



-- 
Roger
http://rogerx.freeshell.org/



More information about the Abcde-users mailing list