Mailinglist Archive: opensuse (4237 mails)

< Previous Next >
Re: [SLE] Pullin' my hair out... arrrgh
  • From: Randall R Schulz <rschulz@xxxxxxxxx>
  • Date: Wed, 4 Aug 2004 11:57:37 -0700
  • Message-id: <200408041157.37972.rschulz@xxxxxxxxx>
Anders,

On Wednesday 04 August 2004 11:50, Anders Johansson wrote:
> On Wednesday 04 August 2004 20:43, Dylan wrote:
> > On Wednesday 04 Aug 2004 19:33 pm, Randall R Schulz wrote:
> > > ...
> > >
> > > Here documents are cool, but they make scripts harder to read and
> > > understand, so I avoid using them unless they're really necessary.
> >
> > What are 'here documents'?
>
> The format I used in my mail. Insanely useful. ...

Useful? Definitely. Insane? Perhaps. Insanely useful? Perhaps only to the
insane...

Anyway, one of my favorite uses of here documents are for setting PATH and
PATH-like variables (PATH, CDPATH, CLASSPATH, etc.):

export PATH=`tr $'\n' ":" <<-endPATH
.
$HOME/bin
/usr/local/bin
/opt/cxoffice/bin
/sbin
/usr/sbin
/bin
/usr/bin
/usr/X11R6/bin
/opt/kde3/bin
/opt/gnome/bin
endPATH`

# Strip the trailing colon produced by the unavoidable
# newline at the end of the here document

PATH="${PATH%:}"



Randall Schulz

< Previous Next >
Follow Ups