99 bottles of beer: Difference between revisions
Content deleted Content added
→{{header|Scratch}}: This image is too wide. Use some CSS "overflow: auto;" to insert a horizontal scroll bar. Works with Firefox. |
→{{header|UNIX Shell}}: Tweak Bourne Shell to output complete verses. Add C Shell. |
||
Line 4,015: | Line 4,015: | ||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
{{works with| |
{{works with|Bourne Shell}} |
||
<lang bash>#!/bin/sh |
<lang bash>#!/bin/sh |
||
i=99 |
i=99 s=s |
||
while [ $i - |
while [ $i -gt 0 ]; do |
||
if [ $i -gt 1 ] || [ $i -eq 0 ]; then |
|||
s="s" |
|||
else |
|||
s="" |
|||
fi |
|||
echo "$i bottle$s of beer on the wall" |
echo "$i bottle$s of beer on the wall" |
||
echo "$i bottle$s of beer |
|||
⚫ | |||
Take one down, pass it around" |
Take one down, pass it around" |
||
⚫ | |||
fi |
|||
⚫ | |||
i=`expr $i - 1` |
i=`expr $i - 1` |
||
[ $i -eq 1 ] && s= || s=s |
|||
done |
|||
⚫ | |||
⚫ | |||
" |
|||
done</lang> |
|||
{{works with|Bash}} |
{{works with|Bash}} |
||
Line 4,059: | Line 4,054: | ||
echo |
echo |
||
done</lang> |
done</lang> |
||
==={{header|C Shell}}=== |
|||
<lang csh>@ i=99 |
|||
set s=s |
|||
while ($i > 0) |
|||
echo "$i bottle$s of beer on the wall" |
|||
echo "$i bottle$s of beer" |
|||
echo "Take one down, pass it around" |
|||
@ i = $i - 1 |
|||
if ($i == 1) then |
|||
set s= |
|||
else |
|||
set s=s |
|||
endif |
|||
echo "$i bottle$s of beer on the wall" |
|||
echo "" |
|||
⚫ | |||
=={{header|UnixPipes}}== |
=={{header|UnixPipes}}== |