re: Which mainstream programming language has the ugliest syntax? VIEW POST

VIEW FULL DISCUSSION

Does BASH count? :|

if [! -d './directory']; then
  echo 'nope'
else
  echo 'yep'
fi

:|

Sorry but it's ugly only because it's wrong (there should have been additional spaces before and after square brackets) ;)

The BASH is powerful and its syntax allows to write easy to read code. It just needs some rules to follow. For instance, there can be found a quite good Shell Style Guide from Google

In this particular example, it could be written even simpler

[[ -d directory ]] && echo yep || echo nope

That is going to be very helpful! Thank you.

IMHO the worst bash quirk is not being able to put whitespace around the assignment operator, ie.:


foo = bar # syntax error
foo=bar # works as expected

*cough* set -o to turn an option on and set +o to turn it off *cough*

That would be Bourne Shell's fault, not BASH.

code of conduct - report abuse