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

Pages: 1-

First Shell Script

Name: Anonymous 2009-09-21 19:23

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

Name: Anonymous 2009-09-21 19:27

Please use the [code] tags. Thank you.

Name: Anonymous 2009-09-21 19:44

>>2
Okay, mage...


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


Now writing to test for no arguments.

Name: Anonymous 2009-09-21 19:58

>>3
You might enjoy the Haskell programming language and the [o]point[o]less style.

Name: Anonymous 2009-09-21 20:44

Make a script that actually does something next time, please.

Name: Anonymous 2009-09-21 21:30

$ fag()
if [ $1 -lt 0 ]
then echo "$1 is a negative number"
elif [ $1 -eq 0 ]
  then echo "$1 is number zero"
  else echo "$1 is a positive number"
fi
$ fag a
-bash: [: a: integer expression expected
-bash: [: a: integer expression expected
a is a positive number

Name: Anonymous 2009-09-21 21:32

>>6
fuck you shiicham

Name: TRUE TRUTH EXPERT !tQq1sLlmuk 2009-09-22 7:18

fUCK YOU TOO!

Name: Anonymous 2009-09-22 19:20


#!/bin/sh
if [ $# -eq 0 ]
then echo "signum: no number supplied" 1>&2
exit 2
fi

if [ $1 -lt 0 ]
then echo "$1 is a negative number"
elif [ $1 -eq 0 ]
  then echo "$1 is the number zero"
  else echo "$1 is a positive number"
fi
exit 0

Name: TRUE TRUTH EXPERT !tQq1sLlmuk 2009-09-23 6:34


(FORMAT T "iF YOU CAN'T TELL WHETHER ~A IS NEGATIVE OR NOT, YOU'RE A FUCKING RETARD.~%" (SIGNUM (READ)))

Name: Anonymous 2009-09-23 8:54

how do I parse multiple arguments?
With a for-do-done cycle and $@?

Name: Anonymous 2009-09-23 9:09

>>11
http://tldp.org/LDP/abs/abs-guide.pdf
VERY GOOD GUIDE VERY GOOD!!!!!!

Name: Anonymous 2009-09-23 13:53

(with-input-from-string (*standard-input* "#c(1 -2)")
  (>>10))

Name: TRUE TRUTH EXPERT !tQq1sLlmuk 2009-09-23 15:41

>>13
SIGNUM WORKS WITH COMPLEX NUMBERS. cLEARLY, C CAN EITHER BE NEGATIVE OR SOMETHING ELSE, AND SPECIFICALLY IF IT'S A COMPLEX NUMBER IT FALLS IN THE LATTER CASE, AND AGAIN, IF YOU CAN'T TELL #C(0.4472 -0.8944) IS A COMPLEX NUMBER JUST BY LOOKING AT IT YOU'RE TARDER THAN THE TARDEST TARD IN TARDVILLE, AND THAT ALONE IS SUFFICIENT TO CHANGE THE SUBJECT OF THIS THREAD FROM 'SHELL SCRIPTING' TO 'MOCK >>13'.

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