I did and try but not able to rectify

[email protected]:~/PRABHAT/unix$ bash valcode.sh

valcode.sh: line 5: unexpected EOF while looking for matching ``' valcode.sh: line 19: syntax error: unexpected end of file

IFS="|"
while echo "Enter deparment code:" ; do
        read dcode
        set -- `grep "^$dcode" <<-limit
        01|accounts|6123
        02 | admin | 5423
        03 | marketing |6521
        04 | personnel |2365
        05 | production | 9876
        06 | sales | 1006
        limit'
        case $# in
                3) echo "deparment name : $2\nEmp-id of head of dept :$3\n"
                    shift 3 ;;
                *) echo "Invalid code" ; continue
        esac
done

the output is not coming as per desire

1 Answers

0
Jon Guiton On

On line 4 you write `grep but the backtick ` is unmatched. Backticks always come in pairs so the interpreter keeps going looking for the match. Eventually it reached the end of the file without finding it and gives up.

Adding the matching backtick (at the end of the line?) will solve this problem.