2019-02-14 04:45:39 +00:00
|
|
|
|
NEW
|
|
|
|
|
PREFIX
|
|
|
|
|
AUTO 4,1
|
2019-02-18 05:41:06 +00:00
|
|
|
|
#!/BIN/SH
|
2019-02-14 04:45:39 +00:00
|
|
|
|
#
|
|
|
|
|
# This is a test of passing args
|
|
|
|
|
# This script is called by ARGTEST passing a known set
|
|
|
|
|
# of arguments which this script checks to verify
|
|
|
|
|
# arg passing works.
|
|
|
|
|
#
|
|
|
|
|
# The args passed are:
|
|
|
|
|
#
|
|
|
|
|
# A 1 B 2 C 3 Hello $$ 82 Tenth
|
|
|
|
|
#
|
|
|
|
|
# Note that $$ is passed which is this process id
|
|
|
|
|
# of the calling script that can be compared with this
|
|
|
|
|
# scripts parent process id; validating both are working.
|
|
|
|
|
#
|
|
|
|
|
# $0 should be name of script
|
|
|
|
|
#
|
2019-03-07 02:13:28 +00:00
|
|
|
|
IF [ -Z $T ]
|
|
|
|
|
SET T = 0
|
|
|
|
|
FI
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET T = $T + 1
|
2019-03-07 02:13:28 +00:00
|
|
|
|
IF [ $0 = "${PWD}ARGTEST2" ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 0 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 0 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 0 Failed - $0" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 0 Failed - $0"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $1 should be 'A'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $1 = "A" ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 1 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 1 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 1 Failed - $1" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 1 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $2 should be '1'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $2 -EQ 1 ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 2 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 2 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 2 Failed - $2" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 2 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $3 should be 'B'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $3 = "B" ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 3 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 3 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 3 Failed - $3" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 3 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $4 should be '2'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $4 -EQ 2 ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 4 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 4 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 4 Failed - $4" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 4 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $5 should be 'C'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $5 = "C" ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 5 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 5 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 5 Failed - $5" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 5 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $6 should be '3'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $6 -EQ 3 ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 6 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 6 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 6 Failed - $6" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 6 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $7 should be 'Hello'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $7 = "Hello" ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 7 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 7 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 7 Failed - $7" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 7 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $8 should be the process id of the parent
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $8 -EQ $@ ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 8 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 8 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 8 Failed - $8 vs $@" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 8 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $9 should be '82'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
2019-03-07 02:13:28 +00:00
|
|
|
|
IF [ $9 -EQ 82 ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg 9 Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 9 Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg 9 Failed - $9" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg 9 Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
|
|
|
|
# $# should be '10'
|
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
|
|
|
|
IF [ $# -EQ 10 ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg Count Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg Count Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg Count Failed - $#" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg Count Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
|
|
|
|
#
|
2019-03-07 02:13:28 +00:00
|
|
|
|
# $* should be 'A 1 B 2 C 3 Hello $@ 82 Tenth'
|
|
|
|
|
# Note $$ was actually passed after Hello, but
|
|
|
|
|
# we sub $@ as its our parents ID.
|
2019-02-14 04:45:39 +00:00
|
|
|
|
#
|
|
|
|
|
SET T = $T + 1
|
2019-03-07 02:13:28 +00:00
|
|
|
|
IF [ $* = "A 1 B 2 C 3 Hello $@ 82 Tenth" ]
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET P = $P + 1
|
|
|
|
|
echo "ARGTEST Arg ALL Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg ALL Passed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
ELSE
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
SET F = $F + 1
|
|
|
|
|
echo "ARGTEST Arg ALL Failed - $*" >> ${Log}
|
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
echo "ARGTEST Arg ALL Failed"
|
2019-02-14 04:45:39 +00:00
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "Arg Tests Done"
|
2019-03-01 18:19:14 +00:00
|
|
|
|
IF [ -N $Log ]
|
2019-02-14 04:45:39 +00:00
|
|
|
|
echo "Arg Tests Complete" >> ${Log}
|
|
|
|
|
FI
|
|
|
|
|
MAN
|
|
|
|
|
TEXT /MAKE/USR/SHARE/TESTS/ARGTEST2
|