skynet/shell/bashrc.d/03-functions.sh

30 lines
641 B
Bash

# dictionary
define(){
dict -d gcide "$1" | bat
}
# thesaurus
synonym(){
dict -d moby-thesaurus "$1" | bat
}
# mount with user permissions
mmount(){
sudo mount -o uid=`whoami`,gid=`whoami` "/dev/$1" "/mnt/$2"
}
# easy ssh-agent persistence
function ssha() {
test=`ps -ef | grep '\sssh-agent$' | grep -v grep | awk '{print $2}' | xargs`
if [ "$test" = "" ]; then
if [ -e "~/.ssh-agent.sh" ]; then
rm -f ~/.ssh-agent.sh
fi
ssh-agent | grep -v echo >&~/.ssh-agent.sh
fi
test -e ~/.ssh-agent.sh && source ~/.ssh-agent.sh
ssh-add -l > /dev/null || ssh-add
}
test -e ~/.ssh-agent.sh && source ~/.ssh-agent.sh