<<eof ..... eof questions

Johnny Szeto szeto at aludra.usc.edu
Sun Sep 23 08:17:11 AEST 1990


There is a problem with an interactive shell command I try to use:

[shakyamuni:54 :~] foreach i (*2)
? set g=`sed 's/\(.*\)2/\1/'<<fg
? $r[$b]
? fg`
? mv $i $g
? @ b++
? end
The above paragraph is typed on a current shell since I have to change some 
filenames in the current shell.

On line two by the end of the sentence I try to use a here statement
so that sed will execute the variable $r[$b] as a standard input typed
at the terminal if I use < instead of << thru sed will take the stuff
inside the variable, by the way the variable contains filename so sed
will take everything inside the file as input rather the filename
itself.  But the problem is the command substitution quotes `` has to
be on the same line since when I execute it it says unmatched `.  I
guess the problem is when I go to line 3 the shell gives me another
subshell prompt so it apparently has already execute line 2 before I
complete the `` command.

I am quite a novice in programming C-shell.  Can someone give me some
guidance?



More information about the Comp.unix.programmer mailing list