new functionality:

* added human readable output to `ll`
* added custom bash builtins to convert binary and hexadecimal numbers
master
Michael Ochmann 3 years ago
parent 6da598c643
commit a535ecee2c
  1. 28
      .bashrc

@ -43,6 +43,7 @@ export PATH="/usr/texbin:$PATH"
export PATH="$PATH:/Users/mochmann/.dotnet/tools"
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
export PATH="/usr/local/opt/libpq/bin:$PATH"
export PATH="/usr/local/share/dotnet:$PATH"
export CC=clang
export CXX=clang++
export PATH="/usr/local/lib/python3.9/site-packages:$PATH"
@ -265,6 +266,31 @@ panpdf() {
pandoc -w pdf -o "$folder/$name.pdf" "$folder/$file"
}
# custom bash bultins
bash_plugin() {
input=$(history 1 | tr -s ' ' | cut -d " " -f 5)
prefix=${input:0:2}
if [[ "$prefix" == "0x" ]]; then
printf "%d\n" $input
echo -n "0b"
binary=$(printf "obase=2;%d\n" $input | bc)
echo -n "$binary"
history -d -1
kill -INT $$
elif [[ "$prefix" == "0b" ]]; then
value=${input:2}
decimal="$((2#$value))"
echo $decimal
printf "0x%x" $decimal
history -d -1
kill -INT $$
fi
}
trap bash_plugin DEBUG
# ENVIRONMENT
NPM_PACKAGES="${HOME}/.npm-packages"
@ -293,7 +319,7 @@ if [ -x /usr/local/bin/rbenv ]
fi
# ALIASES
alias ll="ls -lisa"
alias ll="ls -lisah"
alias la="ls -A"
alias l="ls -CF"
alias histgrep='history | grep $@'

Loading…
Cancel
Save