myfind and mypath interactive bash session helper function.
--- a/.bashrc Wed Aug 27 23:32:53 2014 +0300
+++ b/.bashrc Wed Sep 10 03:04:57 2014 +0300
@@ -107,6 +107,24 @@
# make and change to a directory
md () { mkdir -p "$1" && cd "$1"; }
+myfind() { find . -iname "$1"; }
+mypath() {
+ local var="$2"
+ [[ -z $var ]] && var=PATH
+ local delim="$3"
+ [[ -z $delim ]] && delim=:
+ local split
+ IFS="$delim" command eval "read -ra split <<< \"\${$var}\""
+ for dir in "${split[@]}"; do
+ [[ -z "$dir" ]] && continue
+ if [[ -f "$dir"/"$1" ]]; then
+ echo "$dir"/"$1"
+ else
+ ls -d "$dir"/$1 2>/dev/null | cat
+ fi
+ done
+}
+
# LANG=C for speed.
alias grep='GREP_COLOR="31;47" LANG=C grep -n --color=auto'
alias ls='ls --color=auto'