Changeset 128


Ignore:
Timestamp:
Jun 13, 2017, 2:38:01 PM (3 years ago)
Author:
g7moreau
Message:
  • Begin -c implementation (command)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tssh/tssh

    r126 r128  
    2626   -h  help
    2727
    28 DEPEND
     28DEPENDS
    2929   On Debian, you need the package
    30    
     30
    3131    apt-get install tmux ncurses-bin wamerican nmap
    3232
     
    3838   This is not mandatory for general use.
    3939
     40   By default, tssh use tput to know the number of columns and lines of your terminal.
     41   It takes 10 lines and 40 columns for each windows by default.
     42   If tput is not installed, the default is 16 windows...
     43
    4044AUTHOR
    4145   Gabriel Moreau
     
    4751   }
    4852
     53export remote_command=''
    4954export split_number=16
    5055if which tput > /dev/null
     
    6166# get options
    6267if [ $# -eq 0 ]; then usage; exit 1; fi
    63 while getopts "w:fvh" options
     68while getopts "w:c:fvh" options
    6469do
    6570   case ${options} in
     
    6873         then
    6974            export split_number=${OPTARG}
     75         else
     76            usage
     77            exit 2
     78         fi
     79         ;;
     80      c)
     81         if echo ${OPTARG} | egrep -q '[[:alpha:]]'
     82         then
     83            export remote_command=${OPTARG}
    7084         else
    7185            usage
     
    160174   IFS=$'\n' host=($(cat "/tmp/${base_path}/${f}"))
    161175
    162    tmux -2 new-session -d -s $session "ssh ${host[0]}"
     176   tmux -2 new-session -d -s $session "ssh ${host[0]} ${remote_command}"
    163177
    164178
    165179   for (( i=1 ; i < ${#host[@]} ; i++))
    166180   do
    167       tmux splitw -t $session "ssh ${host[$i]}"
     181      tmux splitw -t $session "ssh ${host[$i]} ${remote_command}"
    168182      tmux select-layout tiled
    169183   done
Note: See TracChangeset for help on using the changeset viewer.