bug-bash
[Top][All Lists]
Advanced

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

Re: (feature request) here-document, but from a file


From: Bob Proulx
Subject: Re: (feature request) here-document, but from a file
Date: Sat, 2 Jul 2005 17:48:40 -0600
User-agent: Mutt/1.5.9i

Chris F.A. Johnson wrote:
> William Park wrote:
> >It would be nice if I can read a file and process it as though it was
> >here-document text in the script.  Mainly, I want variable substitution,
> >without calling lots of 'sed'.
> >
> >In Python, you would do
> >   print "..." % ...
> >
> >So, perhaps, you can use syntax like
> >   cat <<+ file
> >   cat <<<< file
> 
>     Why can't you use:
> 
> cat < file

The original poster said that the behavior wanted was variable
substitution as in a here-document.  Using 'cat < file' would not
expand any variables.

However counter proposals are useful.  Will this work for you?

  eval echo $(<file)

That will expand variables from the file using existing standard syntax.

Bob




reply via email to

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