Is there any way to use ||
and &&
together in a single line command?
I'm looking to do something whose python equivalent would be:
import os
doSomething() if os.system("[[ -f hello.txt ]]") else doSomethingElse()
Is there any way to use ||
and &&
together in a single line command?
I'm looking to do something whose python equivalent would be:
import os
doSomething() if os.system("[[ -f hello.txt ]]") else doSomethingElse()
There's no "AND" in your python example, is there?
In bash, I would write this simply as
if [ -f hello.txt ]; then
doSomething
else
doSomethingElse
fi