Thread View: comp.unix.shell
2 messages
2 total messages
Started by John Malia
Tue, 30 Oct 1990 18:38
Text to command line
Author: John Malia
Date: Tue, 30 Oct 1990 18:38
Date: Tue, 30 Oct 1990 18:38
28 lines
1312 bytes
1312 bytes
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 *******
Re: Text to command line
Author: Jonathan I. Kamens
Date: Tue, 30 Oct 1990 20:24
Date: Tue, 30 Oct 1990 20:24
54 lines
2018 bytes
2018 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads