X-Git-Url: http://id.pley.net/dotfiles.git/blobdiff_plain/eaa23ff9f75b7242773ccc3214fa3aea21730d8c..13ecc0fef880c1e4a13dd444b2ef3de7c1b00656:/.aliases?ds=inline diff --git a/.aliases b/.aliases old mode 100644 new mode 100755 index f7bc77c..77c68f0 --- a/.aliases +++ b/.aliases @@ -1,8 +1,15 @@ -#!/usr/tcsh -# -# source -# -#stty erase  +#!/bin/bash + +# The following aliases vary depending on the host OS: +case "$(uname -s)" in + Linux ) + alias ls='ls -F --color=auto' + ;; + Darwin ) + alias ls='ls -FG' + ;; +esac + alias m='pine' alias beep='echo ' alias h=history @@ -12,7 +19,6 @@ alias hh='history -r | head' alias ht='history 10' alias p='ps -au' alias tf='tail -25f' -alias ls='ls -FG' alias l='ls -lF' alias la='ls -laF' alias clr='clear' @@ -23,13 +29,10 @@ alias v='vi' alias vt='vi -t' alias ta='vi -t' alias wh='whoami' -alias ff='perl ~/tools/ff.c' alias new='frm -s new' alias du='du -k' -alias df='df -bk' +alias df='df -k' alias shizzle="perl -pe 's/\b(\w*[^aoeuiy])[aoeuiy]+[bcdfghjklmnpqrstvwxz]*\w\b/\1izzle/g'" -alias gvim='open ~/Applications/Vim.app/' -alias qtmlenv='source ~/Projects/qtmlenv' function lh () { last $@ | head; } function ll () { ls -ltF $@ | head; } @@ -47,6 +50,49 @@ function viw () { vi $(which $1); } function toss () { mv -f $@ ~/.trashcan; } function xcopy () { tar cvf - -C $1 $1/* | tar xvf - -C $2; } function checkdns () { ping $( grep nameserver /etc/resolv.conf | awk '{print $2}' | head -1); } -function pidof () { ps -e -o pid,comm | grep "$1" | awk '{print $1}'; } +if [[ $(which -s pidof) -eq 0 ]]; then + function pidof () { ps -e -o pid,comm | grep "$1" | awk '{print $1}'; } +fi + +function ssh-forget() { + sed -i "" "/^$1,/d" ~/.ssh/known_hosts +} + +function ssh-learn() { + sed -i "" "/^$1,/d" ~/.ssh/known_hosts + ssh-keyscan -t rsa $1 >> ~/.ssh/known_hosts +} + +function _ssh_complete() { + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + opts=$( grep -o '^[^, ]\+' ~/.ssh/known_hosts ) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 +} +complete -F _ssh_complete ssh + +function _ssh_screen () { + DISCONNECT="" + RECONNECT="-R" + HOST=$1 + while [ "$2" != "" ]; do + case $2 in + -d | --disconnect ) + DISCONNECT="-D" + ;; + * ) + echo "Usage: $HOST [-d | --discconnect]" + return 1 + ;; + esac + shift + done + + ssh -t $HOST screen $DISCONNECT $RECONNECT +} +for host in ssh_hosts=$( grep '^Host[ ][^*]' ~/.ssh/config | cut -c 6- ); do + alias "$host"="_ssh_screen $host $@" +done