-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathssh
More file actions
30 lines (27 loc) · 943 Bytes
/
ssh
File metadata and controls
30 lines (27 loc) · 943 Bytes
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
#!/bin/bash
# seeing as ssh is going to the dogs, lets fix the user
# prompt instead of using the default system user name
DIR=$(basename $(cd $(dirname "$0"); pwd))
if [[ ! -f "$HOME/bin/ssh" ]] || [[ "$1" == "install" ]]; then
filename="$PWD"/$(basename $0)
echo "installing the script to HOME/bin/ssh"
mkdir -p "$HOME/bin"
cp -f "$filename" "$HOME/bin/ssh"
chmod a+x $HOME/bin/ssh
echo "adding in the path option for it"
echo "PATH=$HOME/bin:$PATH" >> "$HOME/.bashrc"
echo "all done. please use the command by typing 'ssh'"
else
if [[ ! "$DIR" == "bin" ]]; then
echo "the script can be run using the standard 'ssh' command now"
echo
fi
fi
if [[ ! "$1" == "install" ]]; then
if [[ "$@" == *@* ]] || [[ "$@" == *-l* ]] || [[ "$@" == "" ]]; then
/usr/bin/ssh "$@"
else
read -p "please enter your username: " username
/usr/bin/ssh "$@" "-l$username"
fi
fi