Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Shell NAN?

Name: Anonymous 2010-09-14 15:41

Okay guys, I made a naïve script to test if a number was positive/zero/negative.


#!/bin/sh
if [ $1 -lt 0 ]
then echo "$1 is negative"
elif [ $1 -eq 0 ]
  then echo "$1 is 0"
  else echo "$1 is positive"
fi


And I wanted to make it more robust. How can I test if the argument provided is a valid number?

Name: Anonymous 2010-09-16 15:26

>>24

still needs to redirect to /dev/null

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List