Problem echoing special characters with '<<'

Problem echoing special characters with '<<'

Post by bigg.. » Fri, 26 Jan 2001 01:19:54



I am using the '<<' operator in a shell script to echo output to an
Oracle sqlplus command line. This works fine unless I have to implement
a command which uses a special character such as '$', which
unfortunately for my purposes this is critical as many of the Oracle
system views and tables use '$' as part of their identifier. Does
anyone know how I can escape special characters in these circumstances,
as I have tried various methods such as using / and single quotes
around the command sequence to be echoed but none seem to work. I have
read something about 'echo' having problems coping with backslash
escapes on the FAQ, is this a related issue?

I appreciate any more information that could help me resolve this.

--
Robert Honeyman

Oracle DBA

Sent via Deja.com
http://www.deja.com/

 
 
 

Problem echoing special characters with '<<'

Post by Kurt J. Lanz » Fri, 26 Jan 2001 02:04:42



> I am using the '<<' operator in a shell script to echo output to an
> Oracle sqlplus command line. This works fine unless I have to implement
> a command which uses a special character such as '$', which
> unfortunately for my purposes this is critical as many of the Oracle
> system views and tables use '$' as part of their identifier. Does
> anyone know how I can escape special characters in these circumstances,
> as I have tried various methods such as using / and single quotes
> around the command sequence to be echoed but none seem to work. I have
> read something about 'echo' having problems coping with backslash
> escapes on the FAQ, is this a related issue?

> I appreciate any more information that could help me resolve this.

Use \$, then "man sh" and RTFM regarding quoting in
general.

 
 
 

Problem echoing special characters with '<<'

Post by Dan Merc » Fri, 26 Jan 2001 02:16:42




> I am using the '<<' operator in a shell script to echo output to an
> Oracle sqlplus command line. This works fine unless I have to implement
> a command which uses a special character such as '$', which
> unfortunately for my purposes this is critical as many of the Oracle
> system views and tables use '$' as part of their identifier. Does
> anyone know how I can escape special characters in these circumstances,
> as I have tried various methods such as using / and single quotes
> around the command sequence to be echoed but none seem to work. I have
> read something about 'echo' having problems coping with backslash
> escapes on the FAQ, is this a related issue?

> I appreciate any more information that could help me resolve this.

> --
> Robert Honeyman

> Oracle DBA

> Sent via Deja.com
> http://www.deja.com/

Observe the difference:

      $ cat ~/bin/tb
      #!/usr/bin/ksh

      cat <<EOF
      $HOME
      $LOGNAME
      $TZ
      EOF
      cat <<\EOF
      $HOME
      $LOGNAME
      $TZ
      EOF
      cat <<'EOF'
      $HOME
      $LOGNAME
      $TZ
      EOF
      cat <<"EOF"
      $HOME
      $LOGNAME
      $TZ
      EOF
      $ tb
      /home/dam
      dam
      CST6CDT
      $HOME
      $LOGNAME
      $TZ
      $HOME
      $LOGNAME
      $TZ
      $HOME
      $LOGNAME
      $TZ

So,  as you see,  if you escape the end marker tag then no
variable expansion occurs.  As far as escaping a single $,
the following works:

      $ cat ~/bin/tb
      #!/usr/bin/ksh
      cat <<EOF
      \$HOME
      $LOGNAME
      $TZ
      EOF
      $ tb
      $HOME
      dam
      CST6CDT

--
Dan Mercer

Opinions expressed herein are my own and may not represent those of my employer.

 
 
 

1. <<<<<soundconfig problem <<<<<<<

hi,
I have a PC100 m747 mainboard
with onboard SIS AGP 6326 8meg videocard
with onboard Sound 3d with sounblaster 16 and WSS support

my SIS videocard works fine
i have problems to configure the soundcard
it claims to be soundblaster compatible , but installing a
'sounblaster 16' , 'soundblaster pro' 'WSS' 'MAD16' has no effect
just "modprobe: devive is busy or not found"

--
Microsoft, just the product of a society
     that's lost it's good manners

--
Microsoft, just the product of a society
     that's lost it's good manners

--
Microsoft, just the product of a society
     that's lost it's good manners

2. error in my messages log

3. I need a example of X .twmrc file PLEASE <<<<<<<<<<<<<<<<<<<<<

4. SMP: slicing by -process- or -thread- ?

5. SOLARIS 2.3 NOT getting the NAMESERVER <<<<<<<<<<<<<<<<<<<<

6. Floating point math library in kernel?

7. I think I've found the rectum of the internet.<<<<<<<<<<<<

8. How to get 8bpp visuals on 16bpp server?

9. Script for makeing whole bunch of account of sol. 2.3 <<<<<<<<<<<<<<<<<

10. CDE <<<<<<<<<-------------- Need Help !

11. How can grep the 8th of Field <<<<<<<<

12. How can I trap a user in script <-<-<-<-<-<-<-<-

13. diff among echo a>f; command<f; echo $a|command; command << $a; EOF