Bash script - check if three commands are true
I am trying to check if all three mountpoint commands return true. However when I run the bash script I get a binary operator expected error.
if [[ mountpoint -q /mnt/foo1 && mountpoint -q /mnt/foo2 && mountpoint -q /mnt/foo3 ]] then echo "all three true" else echo "all three not true" fi |
Quote:
Code:
if mountpoint -q /mnt/foo1 && mountpoint -q /mnt/foo2 && mountpoint -q /mnt/foo3 From man bash Quote:
|
I get the same binary operator error using that syntax as well.
|
Got it working with the following:
if [[ $(mountpoint /mnt/foo1) && $(mountpoint /mnt/foo2) && $(mountpoint /mnt/foo3) ]] |
All times are GMT -5. The time now is 11:22 PM. |