groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] What does 'groff <<<foo' do?


From: Mike Bianchi
Subject: Re: [Groff] What does 'groff <<<foo' do?
Date: Mon, 3 Dec 2012 10:46:47 -0500
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Mon, Dec 03, 2012 at 04:12:25PM +0100, Tadziu Hoffmann wrote:
> 
> > Actually all shells that I know of don't specify that
> > redirection take place at the end of the command line.
> > Witness:
> > 
> >     $ <<<$HOME  cat
> >     /home/mbianchi
> > 
> >     $ <<<$HOME >/tmp/i  cat
> >     $ cat /tmp/i
> >     /home/mbianchi
> 
> Hey, that's cool!  I'd never even thought about it.
> So with regard to "proper" left-to-right order we can say
> 
>   <input command >output


Exactly.  For instance

        <infile >outfile  while  read a
                          do
                                process ${a}
                          done

Sidebar:
I always use  ${a}  instead of  $a  so they standout more in the scripts,
for readability.
Also usages like  ${a:-defaultvalue}  are then not as big of a surprise to
novice readers of my shell code.  It's a shell variable with with "benefits".
I wonder sometimes if anyone really understands _all_ of  bash(1) .
I know I don't.  Heck, I never understood all of  ksh .
I'll claim that understood all of  sh  back in 1985 or so.
You know, the original  sh  had a way to do 1 "here document" at the end of a
shell script?

                :
        cat >outfile
        content
        more content
                :

in a shell script file would  cat  the content, down to the end of the file,
into  outfile  just as if you were typing it at a terminal!
I think the  <<EOF ... EOF  syntax was introduced by Steve Bourne and/or John
Mashey back in the before times.

--
 Mike Bianchi
 Foveal Systems

 973 822-2085

 address@hidden
 http://www.AutoAuditorium.com
 http://www.FovealMounts.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]