From f73b91fa7274c8ff92daff6e3780426159a43043 Mon Sep 17 00:00:00 2001 From: Jer Noble Date: Fri, 20 Apr 2012 10:43:14 -0700 Subject: [PATCH 1/1] Update aliases to account for platform-specific differences. --- .aliases | 33 ++++++++++++++++++++++----------- .bash_login | 9 --------- 2 files changed, 22 insertions(+), 20 deletions(-) mode change 100644 => 100755 .aliases diff --git a/.aliases b/.aliases old mode 100644 new mode 100755 index f7bc77c..57300ae --- a/.aliases +++ b/.aliases @@ -1,8 +1,12 @@ -#!/usr/tcsh -# -# source -# -#stty erase  +#!/bin/bash + +# The following aliases vary depending on the host OS: +if [[ "x$(uname -s)" == "xLinux" ]]; then + alias ls='ls -F --color=auto' +elif [[ "x$(uname -s)" == "xDarwin" ]]; then + alias ls='ls -FG' +fi + alias m='pine' alias beep='echo ' alias h=history @@ -12,7 +16,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 +26,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 +47,17 @@ 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 +} diff --git a/.bash_login b/.bash_login index 511d498..96b42af 100644 --- a/.bash_login +++ b/.bash_login @@ -10,15 +10,6 @@ function short_pwd() } export PS1='$( if [ $? = 0 ]; then echo \[\e[32m\]:-\)\ ; else echo \[\e[31m\]:-\(\ ;fi;)\[\e[0m\]\u@\h:$(short_pwd)> ' -ssh-forget() { -sed -i .bak "/^$1,/d" ~/.ssh/known_hosts -} - -ssh-learn() { -sed -i .bak "/^$1,/d" ~/.ssh/known_hosts -ssh-keyscan -t rsa $1 >> ~/.ssh/known_hosts -} - export PATH=~/bin:$PATH export MANPATH=~/man:$MANPATH -- 2.40.1