Language sh
(simple sh example with 1 function)
| Date: | 12/07/07 |
| Author: | Rob Franken |
| URL: | n/a |
| Comments: | 2 |
| Info: | n/a |
| Score: |
#!/bin/sh
#The real sh not with bash extensions
#for testing use dash as interpreter because sh is often simlinked to bash
bottles(){
if test $1 -eq 1
then echo 1 bottle
elif test $1 -eq 0
then echo no more bottles
else echo $1 bottles
fi
}
i=99
until test $i -eq 0
do echo `bottles $i` of beer standing on the wall, `bottles $i` of beer.
i=$(($i-1))
echo Take one down and pass it around, `bottles $i` of beer on the wall.
echo
done
echo No more bottles of beer standing on the wall, `bottles 0` of beer.
echo Go to the store and buy some more, `bottles 99` of beer on the wall.
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments