Skip to content

Instantly share code, notes, and snippets.

@mshafeeqkn
Last active February 13, 2025 10:14
Show Gist options
  • Save mshafeeqkn/794d26711a7201552354493c7a2e77ee to your computer and use it in GitHub Desktop.
Save mshafeeqkn/794d26711a7201552354493c7a2e77ee to your computer and use it in GitHub Desktop.
The PS1 variable for bashrc
parse_git_branch() {
_branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')
_branch="$_branch"
echo $_branch
}
export PS1="\[\033[38;5;42m\]\u@\h\[\033[00m\]:\[\033[38;5;39m\]\W\[\033[38;5;198m\]\$(parse_git_branch)\[\033[00m\]$ "
jk() {
JUNK_DIR=$HOME/.junk/
JUNK_ARGS="$@"
if [ ! -d $JUNK_DIR ]; then
mkdir $JUNK_DIR
fi
if [ "$1" = "-e" ]; then
rm -rf $JUNK_DIR
return
fi
echo ""
for item in $@; do
RAND=$(tr -dc a-z0-9 </dev/urandom | head -c 5; echo)
if [ -d $item -o -f $item ]; then
mv $item $JUNK_DIR/$item.$RAND
echo -e "\033[0;32m$item junked\033[0m"
else
echo -e "\033[0;31m$item doesn't exist\033[0m"
fi
done
echo ""
}
alias ifconfig="ip -c a s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment