[plug] Simple bash scripting problem (again)

Timothy White weirdit at gmail.com
Mon Oct 10 19:28:09 WST 2005


Ok. So it's still not working! This time it's in a compare function!
I'm almost ready to use perl!!!!
Following examples from
http://www.tech-recipes.com/bourne_shell_scripting_tips209.html and
the 'info bash' pages...
I have worked out that this is the syntax for what I want...
if [ $var == "" ]
then
  echo variable is null
fi

In my script it doesn't work!!

Thanks.
Tim

Here is my script in full...(or close enough)

#!/bin/bash

ME=`basename $0`

for file in "$@"; do

if test -f "$file"; then
	ARTIST=`metaflac --show-tag=artist "$file" | sed -e 's/^.*=//'`
	if [ $ARTIST == "" ]; then
		  ARTIST = `echo $file | cut -d- -f1`
	fi
	TITLE=`metaflac --show-tag=title "$file" | sed -e 's/^.*=//'`
	if [ $TITLE == "" ]
		  then
		  TITLE = `echo $file | cut -d- -f2`
	fi
	echo "$ME: File Properties $file"
	echo "$ARTIST - $TITLE.$TRACKINT.flac"
else
	echo "$ME: Can't find $file, skipping"
fi

done



More information about the plug mailing list