So I was writing this little nautilus script for transcoding video into mp3:
#! /bin/bash -x
if [ -z "$1" ]
then
zenity --warning --text="Error - No file selected !"
exit 1
fi
BASEFILENAME=${1%.*}
exec ffmpeg -i "$1" -ab 256k "$BASEFILENAME.mp3" &&
if [ "$?" -eq 0 ]
then
zenity --info --text="Converting successful"
exit
fi
The problem is, though the ffmpeg command is executed successfully the if [ "$?" -eq 0 ]
seems not to get triggered. Why is that? Is the && wrong or is it something else?