bash: $ if [ -d /usr ]; then echo 'yes'; fi yes Perl 5.8.7 and 5.10 $ perl -le 'if (-d "/usr") { print 'yes';}'