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

2005-07-03 Thread William Park
On Sat, Jul 02, 2005 at 11:43:36PM -0400, Chet Ramey wrote:
 Chris F.A. Johnson wrote:
  On Sat, 2 Jul 2005, William Park wrote:
  
  Dear Chet,
 
  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
 
 Because he wants variable substitution.  Something like
 
 cat  $( file)
 
 might work.

Darn it, it does work.  Argghh... I already included a here-file patch
with my latest release:
http://home.eol.ca/~parkw/index.html#herefile
http://home.eol.ca/~parkw/index.html#here_file

Usage:
cat  file
herefile  file
herefile file


Hi Chet.  Off topic... I'm currently considering adding GTK+ interface
to Bash, so that you can do basic dialog stuff in Bash directly.  But,
if it's only dialog stuff, then there isn't much point, because you can
just use real 'dialog' or 'Xdialog'.

Have you come across any project that tries to add GUI features to any
shell?

-- 
William Park [EMAIL PROTECTED], Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
   http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
  http://freshmeat.net/projects/bashdiff/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


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

2005-07-02 Thread Bob Proulx
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


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


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

2005-07-02 Thread Paul Jarc
William Park [EMAIL PROTECTED] 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'.

eval blah EOT
`cat file`
EOT

But this breaks if file contains an EOT line.


paul


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


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

2005-07-02 Thread Chet Ramey
Chris F.A. Johnson wrote:
 On Sat, 2 Jul 2005, William Park wrote:
 
 Dear Chet,

 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

Because he wants variable substitution.  Something like

cat  $( file)

might work.

Chet



-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash