fsck=$(fsck blah) if [[ $fsck == DIRTY ]]; then foobar fsck=$(fsck blah) [[ $fsck == DIRTY ]] && foobar -fk ... fi