Re: run a shell command interactively



> Is there a sawfish command, which will pop up a small shell command
> line, in which i can type some command there and execute. I thought
> there used to be some key to invoke this, but i can't call it back.

Sure, you can just pop up an xterm, snag a single line, and feed it to
the shell.  Here's a command line that I use to prompt for a machine
to connect to, and then do so (runxterm is a private script):

      (system
       (format
	nil
	"(xterm -geometry %s -T xterm-prompt -n xterm-prompt -e sh -c 'echo Destination\?; head -1 > /tmp/pr'$$; runxterm %s %s `cat /tmp/pr$$; rm -f /tmp/pr$$`) &" prompt-geometry xterm-geometry extra-args))

In this case, prompt-geometry, xterm-geometry, and extra-args are all
provided to the function that calls this command.  The first tells
where to put the prompt, the second controls the geometry of the
eventual xterm, and the third is simply passed to my runxterm script.

Here's an (untested) variation that does what William actually asked
for.  It doesn't do anything to make sure you see the output of the
command (if any); that could be done by capturing stderr and stdout
into a file, and then displaying it with either xterm or xmessage.
Note that the entire command sequence is parenthesized and
backgrounded so that sawfish doesn't hang waiting for the thing to
complete.

(setq prompt-geometry "40x3-17+450")

...
; Inside some function:
      (system
       (format
	nil
	"(xterm -geometry %s -T command-prompt -n command-prompt -e sh -c 'echo \?; head -1 > /tmp/pr'$$; sh cat /tmp/pr$$; rm -f /tmp/pr$$) &" prompt-geometry))

-- 
    Geoff Kuenning   geoff cs hmc edu   http://www.cs.hmc.edu/~geoff/

Paymasters come in only two sizes: one sort shows you where the book
says that you can't have what you've got coming to you; the second
sort digs through the book until he finds a paragraph that lets you
have what you need even if you don't rate it.  Doughty was the second
sort.
	-- Robert A. Heinlein, "The Door Into Summer"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]