Hello everyone. After a few hours trying to debug and searching LQ.org and Google and nothing I decided to post so someone could point me somewhere.
Let's get to the point, here's the code:
#it will help to know that "vazio" means empty and multisessao means wheter the disk is appendable ornot.
while [[ "$MULTISESSAO" != "yes" || "$VAZIO" = "no" ]]; do
VAZIO=$(cdrdao disk-info --device /dev/cdrom | grep "CD-R empty" | cut -c24-27)
if [ "$VAZIO" != "yes" ]; then
MULTISESSAO=$(cdrdao disk-info --device /dev/cdrom | grep "Appendable" | cut -c24-27)
if [ "$MULTISESSAO" != "yes" ]; then
echo "A mídia não está vazia e não é multisessão. Troquea-a para que o backup prossiga. Aguardando 15 segundos..." #just tell something to the person.
checkcd #check if there's a cd in the drive
The issue is at the while loop which never ends. It seems so right to me. Surely there's something making it not to work.
First time the loop goes $MULTISESSAO is evaluated true and $VAZIO is evaluated true and second time and so it's the opposite: $MULTISESSAO is now true and $VAZIO is false.
I have no ideas anymore. I also tried without with single square brackets "[ ... ]" but it didn't work either.