Last active
October 14, 2018 16:21
-
-
Save stuarthendren/fd461a078abd2885119a to your computer and use it in GitHub Desktop.
.bashrc windows
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
PATH=$PATH:"/c/dev/todo" | |
PATH=$PATH:"/c/dev/scripts" | |
export PATH | |
FILES=/c/dev/scripts/* | |
for f in $FILES | |
do | |
source $f | |
done | |
export TODOTXT_DEFAULT_ACTION=ls | |
alias t='todo.sh' | |
alias npp='/c/dev/Notepad++/notepad++.exe' | |
alias ll='ls -alh' | |
alias la='ls -A' | |
alias l='ls -CFlh' | |
alias lsd="ls -alF | grep /$" | |
#functions | |
function swap() | |
{ # Swap 2 filenames around, if they exist (from Uzi's bashrc). | |
local TMPFILE=tmp.$$ | |
[ $# -ne 2 ] && echo "swap: 2 arguments needed" && return 1 | |
[ ! -e $1 ] && echo "swap: $1 does not exist" && return 1 | |
[ ! -e $2 ] && echo "swap: $2 does not exist" && return 1 | |
mv "$1" $TMPFILE | |
mv "$2" "$1" | |
mv $TMPFILE "$2" | |
} | |
# extract archives using filetype | |
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xvf $1 ;; | |
*.tbz2) tar xvjf $1 ;; | |
*.tgz) tar xvzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1 ;; | |
*.7z) 7z x $1 ;; | |
*) echo "don't know how to extract '$1'..." ;; | |
esac | |
else | |
echo "'$1' is not a valid file!" | |
fi | |
} | |
# Creates an archive (*.tar.gz) from given directory. | |
function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } | |
# Create a ZIP archive of a file or folder. | |
function makezip() { zip -r "${1%%/}.zip" "$1" ; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment