Compare commits

..

No commits in common. "a3c476ca203d8351fd97a60189f93f6f02b97ecd" and "453a453f4f765ccae48cb1be0402de81ee7afcc0" have entirely different histories.

2 changed files with 5 additions and 20 deletions

23
s3h.sh
View File

@ -2,8 +2,8 @@
# config
DIALOG=dialog #gdialog kdialog
START_DIR="$HOME/.s3h"
VERSION="1.5"
START_DIR='~/.s3h'
VERSION="1.4"
# TODO: use opt parsing
if [[ $# -eq 1 && "$1" == "-v" ]]; then
@ -15,8 +15,6 @@ if [[ $# -eq 1 && -d "$1" ]]; then
START_DIR="$1"
fi
START_DIR=`realpath "$START_DIR"`
if [[ ! -d "$START_DIR" ]]; then
echo "start directory '$START_DIR' does not exist" >&2
echo -e "either create or set 'start directory' parameter\n" >&2
@ -47,13 +45,7 @@ while [[ -z "$configFile" ]]; do
# add file selectors
files=`find $dir -mindepth 1 -maxdepth 1 ! -name '.*' -type f -printf "%f\n" |sort`
for d in $files; do
# text before ~ is tag
if [[ "$d" == *"~"* ]]; then
tag="${d%%~*}"
para+=("$d" "$tag")
else
para+=("$d" "$d")
fi
done
if [[ ${#para[@]} -eq 0 ]]; then
@ -67,7 +59,6 @@ while [[ -z "$configFile" ]]; do
# run dialog
ret=$("$DIALOG" --no-tags --stdout --menu "select connection" 0 0 0 ${para[@]} 2>&1)
if [[ $? -ne 0 ]]; then
clear
exit 1
fi
@ -104,13 +95,7 @@ if [[ -f "$configFile" ]]; then
# clear screen // remove dialog colors
echo "config file '$configFile' selected. connecting..."
# extract user@host if ~ in config file name
login=`basename "$configFile"`
if [[ "$login" == *"~"* ]]; then
login="${login#*~}"
fi
# execute ssh
echo "Running 'ssh ${para[@]} $login'"
ssh ${para[@]} "$login"
echo "Running 'ssh ${para[@]} `basename \"$configFile\"`'"
ssh ${para[@]} `basename "$configFile"`
fi