non ancora funzionante
This commit is contained in:
commit
ee82adfb57
1
port_association
Normal file
1
port_association
Normal file
|
@ -0,0 +1 @@
|
||||||
|
octosrv.me 2323
|
3
setup.sh
Normal file
3
setup.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mkdir ~/.local/share/sshin
|
||||||
|
cp port_association ~/.local/share/sshin/
|
||||||
|
cp sshin ~/.local/bin || echo "Error in copying executable to .local/bin" && echo "Run: sudo cp sshin /usr/bin/"
|
15
sshin
Executable file
15
sshin
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
[[ $# -le 1 ]] && echo "Usage: sshin user hostname/last byte of IP address" && echo "sshin -h for more information" || echo "Optional parameters: custom server port" && echo "Example: \"sshin foo bar.com \" will run \"ssh foo@bar.com -p 2323\""
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
IP_PREFIX="192.168.1."
|
||||||
|
[[ $# -le 1 ]] && usage && exit 1
|
||||||
|
[[ $1 = "-h" ]] && usage -h && exit 1
|
||||||
|
re='^[0-9]+$'
|
||||||
|
command="ssh ${1}@"
|
||||||
|
shift
|
||||||
|
[[ $1 =~ $re ]] && command="${command}192.168.1.$2" || port=$(grep ~/.local/share/sshin/port_association $1 | awk '{print $NF}') && command="${command}$1 -p $port"
|
||||||
|
echo $command
|
Loading…
Reference in New Issue
Block a user