[nycbug-talk] sed Question

Peter Wright pete at nomadlogic.org
Thu Mar 30 18:44:47 EST 2006


> Kev,
>
> Instead of attempting to put the shell variable in the midst of the sed
> commandline,  you may want to build the complete commandline string within
> another variable.  Concatenate the value of $fastest onto the string
> representing the complete commandline.  You could then run the commandline
> using either eval or exec.  Although it looks like you might want to use
> eval, check out the man pages for each to see which is more appropriate to
> your case.
>
> For example, in my environment, the env var $VISUAL is set to "vi".  From
> the shell prompt, If I wanted to edit the file "newfile" the hard way, I
> might execute these commands:
>
> $ commandline="$VISUAL newfile"
> $ echo $commandline
> vi newfile
> $ eval $commandline
> ~
> ~
> ~
> newfile: new file: line 1
> (vi is displayed in all its spartan glory...)

interesting, but then you would not be able to have this run as an
automated process, or am i missing some vi trickery here ;)

-p


-- 
~~oO00Oo~~
Peter Wright
pete at nomadlogic.org
www.nomadlogic.org/~pete
310.869.9459



More information about the talk mailing list