2019-02-21 21:19:56 +00:00
|
|
|
|
NEW
|
|
|
|
|
PREFIX
|
|
|
|
|
AUTO 4,1
|
|
|
|
|
#!/BIN/SH
|
|
|
|
|
#
|
|
|
|
|
# This script uses READ to set a VAR and then attempts
|
|
|
|
|
# to test it for validity as a String or Number
|
|
|
|
|
#
|
|
|
|
|
ECHO "\n\nBasic READ and IF Testing\n\n"
|
|
|
|
|
READ -P "Please type and A and press return: " Z
|
2019-03-03 02:15:17 +00:00
|
|
|
|
ECHO
|
2019-02-21 21:19:56 +00:00
|
|
|
|
ECHO "\nYou typed: $Z\n"
|
|
|
|
|
IF [ $Z = "A" ]
|
|
|
|
|
ECHO "Test Passed First IF"
|
2019-03-03 02:15:17 +00:00
|
|
|
|
ECHO
|
2019-02-21 21:19:56 +00:00
|
|
|
|
ELSE
|
|
|
|
|
ECHO "Test Failed First IF"
|
2019-03-03 02:15:17 +00:00
|
|
|
|
ECHO
|
2019-02-21 21:19:56 +00:00
|
|
|
|
FI
|
|
|
|
|
READ -P "Please type and 1 and press return: " Z
|
2019-03-03 02:15:17 +00:00
|
|
|
|
ECHO
|
2019-02-21 21:19:56 +00:00
|
|
|
|
ECHO "\nYou typed: $Z\n"
|
|
|
|
|
IF [ $Z = "1" ]
|
|
|
|
|
ECHO "Test Passed Second IF"
|
2019-03-03 02:15:17 +00:00
|
|
|
|
ECHO
|
2019-02-21 21:19:56 +00:00
|
|
|
|
ELSE
|
|
|
|
|
ECHO "Test Failed Second IF"
|
2019-03-03 02:15:17 +00:00
|
|
|
|
ECHO
|
2019-02-21 21:19:56 +00:00
|
|
|
|
FI
|
|
|
|
|
MAN
|
|
|
|
|
TEXT /MAKE/USR/SHARE/TESTS/READIF
|