Created test-script for args and fixed typo i lab7e2 (thx to Fredrik who pointed it out)
This commit is contained in:
parent
a836db6394
commit
7fca3e9ab6
@ -18,7 +18,7 @@ if [ ! -w `dirname $File` ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for bin in $Awk $Dialog $Printf; do
|
for Bin in $Awk $Dialog $Printf; do
|
||||||
if [ ! -x $Bin ]; then
|
if [ ! -x $Bin ]; then
|
||||||
echo "Can't execute $Bin"
|
echo "Can't execute $Bin"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -24,7 +24,7 @@ if [ ! -w /tmp/ ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for bin in $Awk $Zenity $Printf $Rm; do
|
for Bin in $Awk $Zenity $Printf $Rm; do
|
||||||
if [ ! -x $Bin ]; then
|
if [ ! -x $Bin ]; then
|
||||||
echo "Can't execute $Bin"
|
echo "Can't execute $Bin"
|
||||||
exit 1
|
exit 1
|
||||||
|
33
Misc/test_args.sh
Executable file
33
Misc/test_args.sh
Executable 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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user