johnm@Solbourne.COM (John Malia) (10/31/90)
I'm not sure if this is where this question belongs, but, here goes... Is there a way to have text that redies in a file be transferred to the command line (ei. I'm running tcsh, if that makes any difference), so it may be executed? For instance, in my .xinitrc file, (definitions file for starting X), I have the following line: /usr/bin/X11/xterm -geometry 125x35+220+175 -fn 8x13 +ls -sb -n Rn -iconic -e rn & I wanted to know if somehow, this line can be read and put on the command line for execution from the shell. I know, Bizarre question huh. Thanks, John 88-{Q -- Solbourne Computers | There's no place, anything like this John Malia ::-{Q 1900 Pike Rd. | place, anywhere near this place, Longmont, Co,. 80501 | ...so this must be the place! ********* What I say is what *I* think, not what Solbourne thinks *******
jik@athena.mit.edu (Jonathan I. Kamens) (10/31/90)
In article <1990Oct30.183840.11819@Solbourne.COM>, johnm@Solbourne.COM (John Malia) writes: |> Is there a way to have text that redies in a file be transferred to the |> command line (ei. I'm running tcsh, if that makes any difference), so |> it may be executed? Use backquotes for command evaluation substitution, and cat the contents of the file: % cat test echo frep % eval `cat test` frep If you only want to execute one line from the file, use grep or sed to select the correct line: % cat test echo frep echo foobar % eval `sed -n 2p test` foobar Finally, you can put the entire file into your command history using "source -h": % cat test echo frep echo foobar % history 5 115 eval `sed -n 2p test` 116 man history 117 dirs 118 cat test 119 history 5 % source -h test % history 5 119 history 5 120 source -h test 121 echo frep 122 echo foobar 123 history 5 % !121 echo frep frep Note that you have to use "eval" in the first two examples I posted above, because of brain-damage in tcsh with deciding when to break up strings into words (the same reason why "kill `cat list-of-PIDS`" doesn't work). -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710