> Date: Fri, 3 Aug 2012 16:17:56 +0200
[...]
> 
> The only way I could do this programmatically is something like
> 
>       $ tmux new-window -d -t mysession: -n window-remotehost "ssh remotehost 
> \"my shellcommandline on the remote host\""
> 
> I hope this already shows the problem: Both tmux and ssh only accept a
> shell commandline for launching a command. That means that the remote
> shell commandline has to be escaped twice, and thus can't be
> parameterized with a shell variable.

Hi Jens,

Your proposal might be something to consider, but you should be able to 
accomplish what you desire without it.  For instance:

#!/bin/bash
A="HELLO"
B="WORLD"
upgradecommand="echo $A $B \$SSH_CONNECTION; cat /etc/passwd; sleep 5"
quoted=$(printf '%q' "$upgradecommand")
tmux new-window -d -t mysession: -n window-remotehost "ssh remotehost ${quoted}"


This will print HELLO WORLD and the value of SSH_CONNECTION on the remotehost 
along with its passwd file.

HTH,
Sean



                                          
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to