mirror of https://github.com/tLDP/LDP
40 lines
735 B
Bash
40 lines
735 B
Bash
#!/bin/bash
|
|
# test-suite.sh
|
|
# A partial Bash compatibility test suite.
|
|
|
|
|
|
# Double brackets (test)
|
|
String="Double brackets supported?"
|
|
echo -n "Double brackets test: "
|
|
if [[ "$String" = "Double brackets supported?" ]]
|
|
then
|
|
echo "PASS"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
|
|
|
|
# Double brackets and regex matching
|
|
String="Regex matching supported?"
|
|
echo -n "Regex matching: "
|
|
if [[ "$String" =~ R.....matching* ]]
|
|
then
|
|
echo "PASS"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
|
|
|
|
# Arrays
|
|
test_arr=FAIL
|
|
Array=( If supports arrays will print PASS )
|
|
test_arr=${Array[5]}
|
|
echo "Array test: $test_arr"
|
|
|
|
|
|
# Completing this script is an exercise for the reader.
|
|
# Add to the above similar tests for double parentheses,
|
|
#+ brace expansion, $() command substitution, etc.
|
|
|
|
exit $?
|