#!/bin/ksh # # set up internal parameters # ERROR_CODE=$1 ERROR_MESSAGE_FILE="error_messages.txt" # This is the default error message if no match is found. ERROR_MESSAGE="No matching error message found for: $ERROR_CODE" ## Retrieve error message while read -r error_number error_message do if test "X$error_number" = "X$ERROR_CODE:" then ERROR_MESSAGE=$error_message break fi done < $ERROR_MESSAGE_FILE ## Print error message printf "%s" "$ERROR_MESSAGE"