Correct all the errors in this code and point out which line its on. Unix Create
ID: 3836904 • Letter: C
Question
Correct all the errors in this code and point out which line its on. Unix
Create a new file named as checkError.sh (vi checkError.sh or nano checkError.sh), then include following lines in your checkError.sh. #/bin/bash/* Check Error Script */echo "Try to find out some errors!!!"| Search for the words which can be matched by regex [^a]*ce #And save the output to file "Result" echo "The regex [^a]* ce can match the string (s)." > Result grep '^[^a]* ce$' Result lance ace brace decide piece -ENDHERE # Check the existence of file "Result" # Send the content in "Result" to your emailbox # $1 is replaced by your campuslD Is mail $1Explanation / Answer
#bin/bash
# invalid command /*check Error Script*/
echo "Try to find some errors!!!"
#Search for the words which can be matched by regex[^a]*ce
#And Save the output to file "Result"
echo "The regex[^a]*ce can match the strings(S):" > Result
grep "[^a]*ce"<<END>> Result
lance
ace
brace
decide
piece
END
#Check the existence of file "Result"
#send the content in Result to your emailbox
#$1 is replaced by your campusID
a="test@student.gsu.edu"
mail $a < Result
#$1 is replaced by your campusID
echo "The result has been sent to ${a}@student.gsu.edu"
echo "Congratulations! You have corrected all errors!"
====================================
Result file
The regex[^a]*ce can match the strings(S):
lance
ace
brace
piece