ELCV
2021-07-13 17:46:43 UTC
Hello
I can't get this right. What I have is a script to backup VM guests. The command is called with an argument, for example:
/usr/local/bin/vm-backup.sh FOO
Some of the VMs have two disks and I want to back them both up. Two of the VMs have vert large data partitions that are backed up separately and I want to exclude them.
If I do this:
if [ "$1" != "FOO" ];
then
echo "I can backup the 2nd volume";
else
exit;
fi
It works. But if I add an "or" condition as follows:
if [ "$1" != "FOO" ] || [ "$1" != "BAR" ] ;
then
echo "I can backup the 2nd volume";
else
exit;
fi
It fails. I have tried this a number of different ways and I can't get it. Any guidance is appreciated. Thanks.
I can't get this right. What I have is a script to backup VM guests. The command is called with an argument, for example:
/usr/local/bin/vm-backup.sh FOO
Some of the VMs have two disks and I want to back them both up. Two of the VMs have vert large data partitions that are backed up separately and I want to exclude them.
If I do this:
if [ "$1" != "FOO" ];
then
echo "I can backup the 2nd volume";
else
exit;
fi
It works. But if I add an "or" condition as follows:
if [ "$1" != "FOO" ] || [ "$1" != "BAR" ] ;
then
echo "I can backup the 2nd volume";
else
exit;
fi
It fails. I have tried this a number of different ways and I can't get it. Any guidance is appreciated. Thanks.