langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
15
Task/Loops-For/UNIX-Shell/loops-for-1.sh
Normal file
15
Task/Loops-For/UNIX-Shell/loops-for-1.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# Using a while control construct to emulate a for loop
|
||||
|
||||
l="1" # Set the counters to one
|
||||
while [ "$l" -le 5 ] # Loop while the counter is less than five
|
||||
do
|
||||
m="1"
|
||||
while [ "$m" -le "$l" ] # Loop while the counter is less than five
|
||||
do
|
||||
printf "*"
|
||||
m=`expr "$m" + 1` # Increment the inner counter
|
||||
done
|
||||
echo
|
||||
l=`expr "$l" + 1` # Increment the outer counter
|
||||
done
|
||||
6
Task/Loops-For/UNIX-Shell/loops-for-2.sh
Normal file
6
Task/Loops-For/UNIX-Shell/loops-for-2.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for i in `jot 5`; do
|
||||
for j in `jot $i`; do
|
||||
printf \*
|
||||
done
|
||||
echo
|
||||
done
|
||||
6
Task/Loops-For/UNIX-Shell/loops-for-3.sh
Normal file
6
Task/Loops-For/UNIX-Shell/loops-for-3.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for (( x=1; $x<=5; x=$x+1 )); do
|
||||
for (( y=1; y<=$x; y=$y+1 )); do
|
||||
echo -n '*'
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
6
Task/Loops-For/UNIX-Shell/loops-for-4.sh
Normal file
6
Task/Loops-For/UNIX-Shell/loops-for-4.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
foreach i (`jot 5`)
|
||||
foreach j (`jot $i`)
|
||||
echo -n \*
|
||||
end
|
||||
echo ""
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue