Does standard input redirection within a variable work differently on RHEL 7 than older versions.

Latest response

Hi there!

I faced an interesting issue. The following code works well on RHEL 5, but drops an error on RHEL7:

case $1 in
 a)
    *some code here*
    ;;
 b)
    *some code here*
    ;;
 c)
    v_rekord=$(sqlplus -s user/password<<EOF
               *select statement here;*
               exit;
          EOF
          )
    ;;
 d)
    *some code here*
    ;;
 *)
    *some code here*
    ;;
esac

Error:
./t2.sh: line 64: unexpected EOF while looking for matching `)'
./t2.sh: line 120: syntax error: unexpected end of file

But it works well between backquotes:

case $1 in
 a)
    *some code here*
    ;;
 b)
    *some code here*
    ;;
 c)
    v_rekord=`sqlplus -s user/password<<EOF
              *select statement here;*
              exit;
     EOF
    `
    ;;
 d)
    *some code here*
    ;;
 *)
    *some code here*
    ;;
esac

Is there an explanation or official statement for this?

Responses