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


Does BASH count? :|

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


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

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*

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.

code of conduct - report abuse