set custom text by using ~ (tilde) in filename
foo~bar@example.org will show "foo" in s3h and connect to "bar@example.org"
This commit is contained in:
parent
53212b705a
commit
0c1c0d4788
18
s3h.sh
18
s3h.sh
@ -47,7 +47,13 @@ while [[ -z "$configFile" ]]; do
|
|||||||
# add file selectors
|
# add file selectors
|
||||||
files=`find $dir -mindepth 1 -maxdepth 1 ! -name '.*' -type f -printf "%f\n" |sort`
|
files=`find $dir -mindepth 1 -maxdepth 1 ! -name '.*' -type f -printf "%f\n" |sort`
|
||||||
for d in $files; do
|
for d in $files; do
|
||||||
para+=("$d" "$d")
|
# text before ~ is tag
|
||||||
|
if [[ "$d" == *"~"* ]]; then
|
||||||
|
tag="${d%%~*}"
|
||||||
|
para+=("$d" "$tag")
|
||||||
|
else
|
||||||
|
para+=("$d" "$d")
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${#para[@]} -eq 0 ]]; then
|
if [[ ${#para[@]} -eq 0 ]]; then
|
||||||
@ -97,7 +103,13 @@ if [[ -f "$configFile" ]]; then
|
|||||||
# clear screen // remove dialog colors
|
# clear screen // remove dialog colors
|
||||||
echo "config file '$configFile' selected. connecting..."
|
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
|
# execute ssh
|
||||||
echo "Running 'ssh ${para[@]} `basename \"$configFile\"`'"
|
echo "Running 'ssh ${para[@]} $login'"
|
||||||
ssh ${para[@]} `basename "$configFile"`
|
ssh ${para[@]} "$login"
|
||||||
fi
|
fi
|
||||||
|
0
test/blah~foobar@devloop.de
Normal file
0
test/blah~foobar@devloop.de
Normal file
Loading…
x
Reference in New Issue
Block a user