Skip to content

Instantly share code, notes, and snippets.

@vitaly
Last active August 29, 2016 12:25
Show Gist options
  • Select an option

  • Save vitaly/7117079 to your computer and use it in GitHub Desktop.

Select an option

Save vitaly/7117079 to your computer and use it in GitHub Desktop.
Run the command in x tmux splits. e.g. `bash x 4 iex` will run `iex` in 4 spilts in tmux
#!/bin/bash -x
N=$1; shift
if [ -z "$N" -o -z "$1" ]; then
cat <<_
Usage: $0 N COMMAND
_
exit 1
fi
S=s$$
tmux new-session -d -s $S "$*"
# we start from 2 because we already have 1 pane
for i in `seq 2 $N`; do
tmux split-window -h -t $S "$*"
tmux select-layout tiled
done
tmux select-pane -t .0
tmux at -t $S
@ramizudd
Copy link
Copy Markdown

ramizudd commented Aug 29, 2016

I have tried this but getting following error -
sessions should be nested with care, unset $TMUX to force

I have windows, with cygwin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment