Skip to content

Instantly share code, notes, and snippets.

@manutter51
Created July 29, 2013 17:48
Show Gist options
  • Save manutter51/6106145 to your computer and use it in GitHub Desktop.
Save manutter51/6106145 to your computer and use it in GitHub Desktop.
bash snippets
#!/bin/bash
alias reload="source ~/.bashrc"
# source the sublimerc file if it exists
if [ -f "${HOME}/.sublimerc" ] ; then
source "${HOME}/.sublimerc"
fi
src()
{
SRCDIR=/cygdrive/c/Users/mnutter/src
if [ -d "$SRCDIR/$1" ] ; then
cd "$SRCDIR/$1"
else
ls $SRCDIR
echo "Property $1 not found in $SRCDIR."
fi
}
_src_dirs()
{
local cur prev opts
COMPREPLY=()
SRCDIR=/cygdrive/c/Users/mnutter/src
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=`ls -1 $SRCDIR`
# if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
# fi
}
complete -F _src_dirs src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment