#!/usr/bin/zsh # typeset -A dir # dir["wiki"]="/mnt/store/Store.Disk/Wiki" # dir["st"]="/mnt/store" # dir["sthome"]="/mnt/store/home" # dir["sd"]="/mnt/store/Store.Disk" # dir["app"]="/mnt/develop/application" # dir["bin"]="/mnt/develop/bin" # dir["cpp"]="/mnt/develop/projects/cpp" # dir["golang"]="/mnt/develop/projects/golang" # dir["pr"]="/mnt/develop/projects" # dir["dev"]="/mnt/develop" # dir["config"]="/home/chatlanin/.config" # dir["docker"]="/mnt/develop/projects/docker" # dir["gitea"]="/mnt/develop/projects/golang/gitea" # dir["sandbox"]="/mnt/develop/projects/cpp/sandbox" # dir["server"]="/mnt/develop/projects/server" # dir["actorfm"]="/mnt/develop/projects/cpp/actorfm" # dir["actorfm.asio"]="/mnt/develop/projects/cpp/actorfm.asio" # dir["dwm"]="/mnt/develop/application/dwm/dwm.6.2" # dir["base"]="/mnt/develop/projects/cpp/base" # dir["hack"]="/mnt/develop/projects/cpp/hack" # dir["rrr"]="/mnt/develop/projects/cpp/rrr" # dir["rendert"]="/mnt/develop/projects/cpp/rendert" # dir["trycaster"]="/mnt/develop/projects/cpp/trycaster" # dir["trycaster.web"]="/mnt/develop/projects/cpp/trycaster/trycaster.web" # dir["league.dance"]="/mnt/develop/projects/cpp/league.dance/v2.0" # dir["goto"]="/mnt/develop/projects/cpp/goto" # dir["auth.base"]="/mnt/develop/projects/cpp/auth.base" # dir["fonmix"]="/mnt/develop/projects/cpp/fonmix" # dir["chatlanin.com.ru"]="/mnt/develop/projects/cpp/chatlanin.com.ru" # dir["task_book"]="/mnt/develop/projects/cpp/task_book" # dir["lua"]="/mnt/develop/projects/lua" typeset -A srv srv["trycaster"]="ssh -p 4999 chatlanin@92.53.65.239" srv["dev_em"]="ssh a.zimin@dev01.emd01.lwb.d-net.pro" srv["em_prod_1"]="ssh a.zimin@prod01.emp01.lwb.d-net.pro" srv["em_prod_2"]="ssh a.zimin@prod02.emp01.lwb.d-net.pro" source /mnt/raid/bin/scripts/system/style typeset -A array array["dir"]=dir array["srv"]=srv MODE_1=\"$1\" # MODE_2=\"$2\" INDEX=1 if [[ $MODE_1 == \"\" ]] then # echo "" # OUTPUT="POS. # DIR'S # COMMAND\n----#--------------------------------#--------------------------------------------------------" # # for key value in ${(kv)dir}; do # OUTPUT="$OUTPUT\n $INDEX # $BOLD$BLUE$key$RESET_COLOR # $ITALIC$CYAN$value$RESET_COLOR" # INDEX=$((INDEX + 1)) # done # # echo -ne $OUTPUT | column -ts $'#' echo "" INDEX=1 OUTPUT="POS. # SERVER NAME # COMMAND\n----#--------------------------------#--------------------------------------------------------" for key value in ${(kv)srv}; do OUTPUT="$OUTPUT\n $INDEX # $BOLD$BLUE$key$RESET_COLOR # $ITALIC$CYAN$value$RESET_COLOR" INDEX=$((INDEX + 1)) done echo -ne $OUTPUT | column -ts $'#' # read MODE_1 MODE_2 read MODE_1 MODE_1=\"$MODE_1\" # MODE_2=\"$MODE_2\" fi # case $MODE_1 in # \"dir\") # cmd=${${(P)array[$MODE_1]}[$MODE_2]} # cd $cmd # ;; # \"srv\") # cmd=${${(P)array[$MODE_1]}[$MODE_2]} # bash -c $cmd # ;; # esac cmd=${${(P)array["srv"]}[$MODE_1]} bash -c $cmd