For most of what you said: You are so right, I hadn't thought it
through.
As long as I'm tweaking the man page anyways, a few other questions
I had before, or that I've come across as I'm working on it. If you
can answer these, I will see about updating the man page as
appropriate.
What is tmux -c *for*? It seems to just be a shortcut to
retrieving and executing the default shell, which is hardly a
horrific bit of scripting so I'm wondering what prompted it.
Why does "tmux new-session vim \; split-window \; attach" not
work? Why does it need the -d, I mean? Seems like attaching a
session shouldn't stop the split-window command from being
proccessed.
What does window linking do? That is, I don't get the practical
use of or relationship between link-window , move-window , and
swap-window. I actually don't understand the man entries for
those at all, and I've heard other people on IRC say the same.
What is select-prompt for? It seems to just ask for a number and
complain if it's not a window number; how is that useful?
On Wed, Jan 20, 2010 at 11:59:13PM +0000, Nicholas Marriott wrote:
> On Wed, Jan 20, 2010 at 03:06:45PM -0800, Robin Lee Powell wrote:
> > On Wed, Jan 20, 2010 at 11:39:40PM +0100, Michel Le Cocq wrote:
>
> You do still need to quote the shell commands, because the
> new-session and new-window commands require those to be one
> argument (as does every other tmux command which accepts shell
> commands).
That was incredibly not-obvious to me; that was a lot of my
confusion. That makes the whole situation much more sensible. :)
> You have a point about overloading of "command" in the man page,
> Perhaps we should always say "shell-command" or "shell command"
> and reserve "command" for "tmux commands", although the former is
> the majority. Diffs are welcome.
Please find attached. :)
> > A bit confusing.
> >
> > Seems to me like there should be exactly one tmux command, call
> > it "run-shell", that takes a shell command, and if you want to
> > run a shell command you have to use that.
>
> Anywhere that accepts a shell command it doesn't make any sense to
> accept a tmux command so I think this would just be redundant
> syntax.
Oh *wow*. No wonder I was confused; I thought all "command"
arguments in the man page were tmux commands first, and if it
couldn't run a tmux command it tried the shell. Or something. I
was fuzzy on that part. :) See man page diff attached.
> The tmux man page isn't the place to talk about shell quoting, we
> define what tmux accepts, the shell man page defines how to quote
> it (remember shells can have different quoting rules).
I talked about it a little bit anyways. :)
-Robin
--
They say: "The first AIs will be built by the military as weapons."
And I'm thinking: "Does it even occur to you to try for something
other than the default outcome?" See http://shrunklink.com/cdiz
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.221
diff -u -r1.221 tmux.1
--- tmux.1 19 Jan 2010 00:46:30 -0000 1.221
+++ tmux.1 21 Jan 2010 09:33:23 -0000
@@ -335,6 +335,23 @@
.Em bottom-right
may be used instead of a pane index.
.Pp
+.Ar shell-command
+arguments are sh(1) commands, as a single argument. What "single
+argument" means can vary from shell to shell if you are calling tmux
+commands that accept such arguments from the command line, but
+inside tmux itself, this means single quotes, like this:
+.Bd -literal -offset indent
+new-window 'vim -o foo bar'
+.Ed
+.Pp
+.Ar command
+arguments are tmux commands, and in contrast to shell
+command arguments, each word of the command must be separate. As a
+result, all
+.Ar command
+arguments are the last argument that command takes: all
+remaining words are consumed.
+.Pp
Multiple commands may be specified together as part of a
.Em command sequence .
Each command should be separated by spaces and a semicolon;
@@ -342,8 +359,36 @@
A literal semicolon may be included by escaping it with a backslash (for
example, when specifying a command sequence to
.Ic bind-key ) .
+In most shells, you will need to quote the semicolon in some way,
+but you cannot simply quote the whole sequence, because each
+command and each backslash must be a separate word, as mentioned in
+the
+.Ar command
+argument section above.
+In sh(1), this command will not work at all, because tmux expects
+each element of a tmux command to be a seperate word:
+.Bd -literal -offset indent
+tmux 'new-session -d vim ; split-window ; attach'
+.Ed
+.Pp
+In contrast, the following command in sh(1) will open up a detached
+tmux session, then split the window, then attach to the session:
+.Bd -literal -offset indent
+tmux new-session -d vim \\; split-window \\; attach
+.Ed
+.Pp
+This is exactly equivalent to the running each of the following in
+the shell:
+.Bd -literal -offset indent
+tmux new-session -d vim
+tmux split-window
+tmux attach
+.Ed
+
.Pp
-Examples include:
+The working version is exactly equaivalent to
+.Pp
+Examples of tmux commands include:
.Bd -literal -offset indent
refresh-client -t/dev/ttyp2
@@ -353,6 +398,10 @@
new-window ; split-window -d
.Ed
+.Pp
+See the
+.Sx EXAMPLES
+section for more.
.Sh CLIENTS AND SESSIONS
The following commands are available:
.Bl -tag -width Ds
@@ -417,7 +466,7 @@
.Op Fl n Ar window-name
.Op Fl s Ar session-name
.Op Fl t Ar target-session
-.Op Ar command
+.Op Ar shell-command
.Xc
.D1 (alias: Ic new )
Create a new session with name
@@ -427,8 +476,8 @@
is given.
.Ar window-name
and
-.Ar command
-are the name of and command to execute in the initial window.
+.Ar shell-command
+are the name of and shell command to execute in the initial window.
.Pp
If run from a terminal, any
.Xr termios 4
@@ -449,7 +498,7 @@
Giving
.Fl n
or
-.Ar command
+.Ar shell-command
are invalid if
.Fl t
is used.
@@ -854,7 +903,7 @@
.Op Fl dk
.Op Fl n Ar window-name
.Op Fl t Ar target-window
-.Op Ar command
+.Op Ar shell-command
.Xc
.D1 (alias: Ic neww )
Create a new window.
@@ -866,11 +915,11 @@
shown, unless the
.Fl k
flag is used, in which case it is destroyed.
-.Ar command
+.Ar shell-command
is the command to execute.
If
-.Ar command
-is not specified, the default command is used.
+.Ar shell-command
+is not specified, the value of the default-command option is used.
.Pp
The
.Ev TERM
@@ -898,7 +947,7 @@
.It Xo Ic pipe-pane
.Op Fl o
.Op Fl t Ar target-pane
-.Op Ar command
+.Op Ar shell-command
.Xc
.D1 (alias: Ic pipep )
Pipe any output sent by the program in
@@ -906,10 +955,10 @@
to a shell command.
A pane may only be piped to one command at a time, any existing pipe is
closed before
-.Ar command
+.Ar shell-command
is executed.
If no
-.Ar command
+.Ar shell-command
is given, the current pipe (if any) is closed.
.Pp
The
@@ -957,14 +1006,14 @@
.It Xo Ic respawn-window
.Op Fl k
.Op Fl t Ar target-window
-.Op Ar command
+.Op Ar shell-command
.Xc
.D1 (alias: Ic respawnw )
-Reactive a window in which the command has exited (see the
+Reactivate a window in which the command has exited (see the
.Ic remain-on-exit
window option).
If
-.Ar command
+.Ar shell-command
is not given, the command used when the window was created is executed.
The window must be already inactive, unless
.Fl k
@@ -1003,7 +1052,7 @@
.Ar size |
.Fl p Ar percentage Oc
.Op Fl t Ar target-pane
-.Op Ar command
+.Op Ar shell-command
.Xc
.D1 (alias: splitw )
Create a new pane by splitting
@@ -1344,10 +1393,10 @@
Set the number of buffers kept for each session; as new buffers are added to
the top of the stack, old ones are removed from the bottom if necessary to
maintain this maximum length.
-.It Ic default-command Ar command
+.It Ic default-command Ar shell-command
Set the command used for new windows (if not specified when the window is
created) to
-.Ar command ,
+.Ar shell-command ,
which may be any
.Xr sh 1
command.
@@ -1414,7 +1463,7 @@
.Ic lock-server
option is set.
The default is not to lock (set to 0).
-.It Ic lock-command Ar command
+.It Ic lock-command Ar shell-command
Command to run when locking each client.
The default is to run
.Xr lock 1
@@ -1565,7 +1614,7 @@
may contain any of the following special character sequences:
.Bl -column "Character pair" "Replaced with" -offset indent
.It Sy "Character pair" Ta Sy "Replaced with"
-.It Li "#(command)" Ta "First line of command's output"
+.It Li "#(shell-command)" Ta "First line of shell-command's output"
.It Li "#[attributes]" Ta "Colour or attribute change"
.It Li "#H" Ta "Hostname of local host"
.It Li "#F" Ta "Current window flag"
@@ -1577,8 +1626,8 @@
.It Li "##" Ta "A literal" Ql #
.El
.Pp
-The #(command) form executes
-.Ql command
+The #(shell-command) form executes
+.Ql shell-command
as a shell command and inserts the first line of its output.
Note that shell commands are only executed once at the interval specified by
the
@@ -2245,14 +2294,16 @@
Lock each client individually by running the command specified by the
.Ic lock-command
option.
-.It Ic run-shell Ar command
+.It Ic run-shell Ar shell-command
.D1 (alias: Ic run )
Execute
-.Ar command
+.Ar shell-command
in the background without creating a window.
-After the command finishes, any output to stdout is displayed in output mode.
+After the
+.Ar shell-command
+finishes, any output to stdout is displayed in output mode.
If
-.Ar command
+.Ar shell-command
doesn't return success, the exit status is also displayed.
.It Ic server-info
.D1 (alias: Ic info )
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users