-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmRemoteNG-OpenSSH.sh
52 lines (45 loc) · 961 Bytes
/
mRemoteNG-OpenSSH.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
sshcmd="$(which ssh)"
for i in "$@"; do
case $1 in
-h=*)
if [ ${#i} -gt 3 ]
then
hostname="${i#*=}";
sshcmd="$sshcmd $hostname";
else
echo "Host missing, exit !"
exit 1
fi
shift;;
-u=*)
if [ ${#i} -gt 3 ]
then
username="${i#*=}";
# echo username=$username;
sshcmd="$sshcmd -l $username";
fi
shift;;
-p=*)
if [ ${#i} -gt 3 ]
then
port="${i#*=}";
# echo port=$port;
sshcmd="$sshcmd -p $port";
fi
shift;;
-f=*)
if [ ${#i} -gt 3 ]
then
SSHConfigFile="${i#*=}";
# echo SSHConfigFile=$SSHConfigFile;
sshcmd="$sshcmd -F $SSHConfigFile";
else
sshcmd="$sshcmd -F ~/.ssh/config"
fi
shift;;
*) ;;
esac
done
echo "$sshcmd"
eval "${sshcmd[@]}"