zsh-users
 help / color / mirror / code / Atom feed
* insert a partial command into the command line
@ 2006-06-24 11:24 Artem Chuprina
  2006-06-29  3:13 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Artem Chuprina @ 2006-06-24 11:24 UTC (permalink / raw)
  To: zsh-users

Hello.

I want the following trick: to invoke from the menu of my window manager
an xterm where to run one command with completion (preferrably - in
disowned state) and exit just after run.  I can run 

xterm -e zsh -i -t

and it will do the most valuable thing of this - allow me to write a
command with completion and then exit.  But I need to write all the
command and manually add '&' to detach it.  I could not find a way to
supply to this shell a partial command (say, "dict " or "ssh
some.host.name ") or to say it that it should automatically run the
command in disowned state (&!).  Could you help me?

-- 
Artem Chuprina
RFC2822: <ran{}ran.pp.ru> Jabber: ran@jabber.ran.pp.ru


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: insert a partial command into the command line
  2006-06-24 11:24 insert a partial command into the command line Artem Chuprina
@ 2006-06-29  3:13 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2006-06-29  3:13 UTC (permalink / raw)
  To: zsh-users

On Jun 24,  3:24pm, Artem Chuprina wrote:
}
} xterm -e zsh -i -t
} 
} and it will do the most valuable thing of this - allow me to write a
} command with completion and then exit.  But I need to write all the
} command and manually add '&' to detach it.

Put this in your ~/.zshrc file:

    if [[ -o interactive && -o single_command ]]
    then
      print -z "$*"
      function auto-bg {
	BUFFER="{ $BUFFER } &|"
	zle .accept-line
      }
      zle -N accept-line auto-bg
    fi

Now you run zsh like

    xterm -e zsh -s -t -i "ssh some.host.name "

The -s is needed to prevent zsh from treating the argument as the name
of a script file.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-29  3:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-24 11:24 insert a partial command into the command line Artem Chuprina
2006-06-29  3:13 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).