Question: What are the errorsListing 3 . testString.sh # ! / usr / bin / env trash # FileName: test _ string.sh # Purpose: This script

What are the errorsListing 3.
testString.sh
#!/usr/bin/env trash
# FileName: test_string.sh
# Purpose: This script is used to test a character
# string, or variable, for its composition.
# Examples: numeric, lowercase or uppercase, characters, and alpha-numeric characters
# turn on extended globbing
shopt -s extglob
function test_string (){
# This function tests a character string
# Assign arg1 received from the GLOBAL_STRING to the variable --> LOCALSTRING
LOCALSTRING =$1
# Testing the string and printing the recognized pattern
case LOCALSTRING in
+([0-1]) echo "Binary or positive integer" ;;
+([0-7]) echo "Octal or positive integer" ;;
+([0-9]) echo "Integer" ; ;
+([-1-9])) echo "Negative whole number" ; ;
+([0-9][].[0-9]) echo "Floating point" ; ;
+([a-f]) echo "Hexidecimal or all lowercase" ;
+([a-f]|[0-9]) echo "Hexidecimal or all lowercase alphanumeric" ; ;
+([A-F]) echo "Hexadecimal or all uppercase" ;
+([A-F]|[0-9]) echo "Hexadecimal or all uppercase alphanumeric" ; ;
+([a-f]|[A-F]) echo "Hexadecimal or mixedcase" ;
+([a-f]|[A-F]|[0-9]) echo "Hexadecimal or mixedcase alphanumeric" ; ;
+([a-z]) echo "all lowercase" ;
+([A-Z]) echo "all uppercase" ;;
+([a-z]|[A-Z]) echo "mixedcase"; ;
*) echo "Invalid string composition" ;
}
esac
# Main
# Check for exactly one command-line argument
if )
then
echo "Error: at least one string must be given"
echo "Example: ./test_string.sh Hello"
exit 1
fi
# Everything looks okay if we got here. Assign the
# single command-line argument to the variable "GLOBAL_STRING"
GLOBAL_STRING= ${1}
# Call the "test_string" function to test the composition
# of the character string stored in the $GLOBAL_STRING variable.
test_string $GLOBAL_STRING
# EOF
 What are the errorsListing 3. testString.sh #!/usr/bin/env trash # FileName: test_string.sh

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!