I am trying to do a simple condition check, but it doesn\'t seem to work.
If $# is equal to 0 or is greater than 1 then say he
$#
0
1
This should work:
#!/bin/bash if [ "$#" -eq 0 ] || [ "$#" -gt 1 ] ; then echo "hello" fi
I'm not sure if this is different in other shells but if you wish to use <, >, you need to put them inside double parenthesis like so:
if (("$#" > 1)) ...