Skip to content

Comment on Write a program that makes 2 + 2 = 5

Comments

  #!/bin/bash
  tty
  if [[ $? -ne 0 ]] ; then
      # command returned nonzero
      echo "not a tty"
  else
      # command returned zero
      n=$?
      ((n=$n+2))
      ((n=$n+2))
      echo "0+2+2=$n";
  fi
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.