Created test-script for args and fixed typo i lab7e2 (thx to Fredrik who pointed it out)

This commit is contained in:
jackbenny committed 2013-12-26 20:14:48 +01:00
1 parent a836db6394
commit 7fca3e9ab6
3 files changed
+35 -2

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Just testing out $@ and $*
Count=1
for param in "$*"; do
echo "\$* Parameter #$Count = $param"
((Count++))
done
Count=1
for param in "$@"; do
echo "\$@ Parameter #$Count = $param"
((Count++))
done
echo ""
echo "Testing with an array"
echo "---------------------"
Count=1
Test=($@)
Count=0
while [ $Count -lt ${#Test[@]} ]; do
echo "Index #$Count is ${Test[$Count]}"
((Count++))
done