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

Charles Steinkuehler charles at steinkuehler.net
Sat Mar 28 20:33:19 GMT 2015


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.  :)

-- 
Charles Steinkuehler
charles at steinkuehler.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: OpenPGP digital signature
URL: <http://lists.einval.com/pipermail/abcde-users/attachments/20150328/a6e37744/attachment.sig>


More information about the Abcde-users mailing list