Created
January 10, 2014 20:46
-
-
Save alastairjwright/8362241 to your computer and use it in GitHub Desktop.
My Bash Profile:
- Cool colors
- cdfinder command selects where you are in the finder
- filestolower command renames all files to lower case
- other useful shit also
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--- list all hidden files in the current folder | |
alias lh='ls -a | egrep "^\."' | |
# | |
# -------------- SVN | |
# | |
alias svnremovemissing='svn status | grep '^\!' | cut -c8- | while read f; do svn rm "$f"; done' | |
alias svna="svn add . --force" | |
#--------------- PATH VARIABLES | |
PATH=$PATH:/usr/local/bin; | |
PATH=$PATH:~/Dropbox/code/bash/bashrc; | |
PATH=~/local/node/bin:$PATH | |
export PATH | |
#------------------ COLORS | |
PS1="[\[\033[36m\]\u\[\033[37m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]]$ " | |
# LESS man page colors ------------------------------------------------- | |
export LESS_TERMCAP_mb=$'\E[01;31m' | |
export LESS_TERMCAP_md=$'\E[01;31m' | |
export LESS_TERMCAP_me=$'\E[0m' | |
export LESS_TERMCAP_se=$'\E[0m' | |
export LESS_TERMCAP_so=$'\E[01;44;33m' | |
export LESS_TERMCAP_ue=$'\E[0m' | |
export LESS_TERMCAP_us=$'\E[01;32m' | |
# converts a raw path to the server to a path the bash understands | |
openserver() | |
{ | |
path=$(echo $1 | sed 's/afp:\/\/coneyisland._afpovertcp._tcp.local/\/Volumes/g') | |
path=$(echo $path | sed 's/%20/\ /g' | sed 's/%5B/\[/g' | sed 's/%5D/\]/g') | |
open "$path" | |
} | |
tree() | |
{ | |
pwd | |
ls -R | grep ":$" | \ | |
sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' | |
} | |
#from micah | |
cdfinder() | |
{ | |
cd "$(osascript -e 'tell application "Finder"' \ | |
-e 'set myname to POSIX path of (target of window 1 as alias)' \ | |
-e 'end tell' 2>/dev/null)" | |
} | |
alias l="ls -alFhG" | |
#-To take whats in your clipboard and replace it with the same text, but stripped of html tags | |
alias stripHTML="pbpaste | sed -e 's/<[^>]*>//g' | pbcopy" | |
#-Quick ip checkers | |
alias en0="ipconfig getifaddr en0" | |
alias en1="ipconfig getifaddr en1" | |
#-Dont delete your files by accident | |
alias rm="rm -i" | |
################################ R E N A M E T O L O W E R C A S E ############################################# | |
# rename all the files which contain uppercase letters to lowercase in the current folder | |
filestolower() | |
{ | |
read -p "This will rename all the files and directories to lowercase in the current folder, continue? [y/n]: " letsdothis | |
if [ "$letsdothis" = "y" ] || [ "$letsdothis" = "Y" ]; then | |
for x in `ls` | |
do | |
skip=false | |
if [ -d $x ]; then | |
read -p "'$x' is a folder, rename it? [y/n]: " renamedir | |
if [ "$renamedir" = "n" ] || [ "$renameDir" = "N" ]; then | |
skip=true | |
fi | |
fi | |
if [ "$skip" == "false" ]; then | |
lc=`echo $x | tr '[A-Z]' '[a-z]'` | |
if [ $lc != $x ]; then | |
echo "renaming $x -> $lc" | |
mv $x $lc | |
fi | |
fi | |
done | |
fi | |
} | |
## | |
# Your previous /Users/alastairwright6/.bash_profile file was backed up as /Users/alastairwright6/.bash_profile.macports-saved_2012-07-04_at_01:59:18 | |
## | |
# MacPorts Installer addition on 2012-07-04_at_01:59:18: adding an appropriate PATH variable for use with MacPorts. | |
export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
# Finished adapting your PATH environment variable for use with MacPorts. | |
#make things pretty! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment