Compare commits

..

No commits in common. "master" and "18b8086955d52cacc92fb923f5db9e181b8b4590" have entirely different histories.

4 changed files with 6 additions and 58 deletions

View File

@ -1,23 +0,0 @@
# sshin - ssh in
# See LICENSE file for copyright and license details.
# paths
PREFIX = /home/${USER}/.local
MANPREFIX = $(PREFIX)/share/man
SHELL = bash
SRC = drw.c dmenu.c stest.c util.c
OBJ = $(SRC:.c=.o)
all: install
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp sshin $(PREFIX)/bin
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp sshin.1 $(DESTDIR)$(MANPREFIX)/man1
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/sshin
rm -f $(DESTDIR)$(MANPREFIX)/man1/sshin.1

View File

@ -1,7 +1,3 @@
#!/bin/bash
[[ $(uname) = "Linux" ]] && grep "sshin" ~/.bashrc >/dev/null || echo "alias sshin=\"~/gitclones/sshin/sshin\"" >> ~/.bashrc; echo "run \"source ~/.bashrc\"";exit
PREFIX=~/.local/
mkdir $PREFIX/share/sshin
[[ -e $PREFIX/share/sshin/port_association ]] || cp port_association $PREFIX/share/sshin/
cp sshin $PREFIX/bin/ || echo "Error in copying executable to $PREFIX/bin" && echo "if on linux, run: sudo cp sshin /usr/bin/"
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/"

11
sshin
View File

@ -6,7 +6,6 @@ usage() {
echo "This tools automatically chooses the server port based on the port_association file in ~/local/share/sshin/port_association"
echo
echo "Example: \"sshin foo bar.com \" will run \"ssh foo@bar.com -p 2323\""
echo "Example: \"sshin foo 43 \" will run \"ssh foo@192.168.1.43\""
return
}
@ -16,16 +15,12 @@ IP_PREFIX="192.168.1."
re='^[0-9]+$'
command="ssh ${1}@"
shift
#[[ $1 =~ $re ]] && command="${command}192.168.1.$2" || port=$(grep $1 ~/.local/share/sshin/port_association | awk '{print $NF}') && command="${command}$1 -p $port"
if [[ $1 =~ $re ]]
then
command="${command}192.168.1.$1"
else
[[ $(uname) = "Linux" ]] && ports_file="$HOME/.local/share/sshin/port_association" || ports_file="$HOME/sshin/port_association"
port=$(grep $1 $ports_file | awk '{print $2}')
command="${command}$1"
[[ -n $port ]] && command="${command} -p $port"
dport=$(grep $1 $ports_file | awk '{print $NF}')
[[ -n $port ]] && command="${command} -D$dport"
port=$(grep $1 ~/.local/share/sshin/port_association | awk '{print $NF}') && command="${command}$1 -p $port"
fi
echo $command
#echo $command
$command

20
sshin.1
View File

@ -1,20 +0,0 @@
.\" Manpage for sshin - ssh in
.\" Contact marco@raber.me to correct errors or typos.
.TH man 8 "27 April 2022" "1.0" "sshin man page"
.SH NAME
sshin \- ssh in(to a machine)
.SH SYNOPSIS
sshin [USER] [last byte of IP address OR hostname]
.SH DESCRIPTION
sshin is a script that simplifies ssh connection. NO MORE REACHING FOR THE @ SYMBOL USED BY THE UTTERLY DERANGED
.SH OPTIONS
sshin options:
.TP
.B \-h
Display help
.SH SEE ALSO
ssh
.SH BUGS
eh ditemeli voi
.SH AUTHOR
Marco Raber (marco@raber.me)