14

executing if-statement from command prompt

view full story
linux-howto

http://unix.stackexchange.com – In bash I can do the following: if [ -f /tmp/test.txt ]; then echo "true"; fi However, if I add sudo in front, it doesn't work anymore: sudo if [ -f /tmp/test.txt ]; then echo "true"; fi -bash: syntax error near unexpected token `then' How can I make it work? (HowTos)