Permalink
Browse files

add uc/lc/subst/static_lib_lookup

  • Loading branch information...
1 parent 4835090 commit 118a3f40cbb7af32633c7a631e6552f48a21b885 @soarpenguin committed Feb 13, 2014
Showing with 14 additions and 0 deletions.
  1. +14 −0 bashrc/standard-funcs-sh
@@ -345,3 +345,17 @@ cleanup()
}
trap cleanup EXIT ## Set trap to call cleanup on exit
+# Find a static library and print it's path
+# XXX: define $try_lib_paths first.
+static_lib_lookup () {
+ for path in $try_lib_paths; do
+ local l=$path/lib$1.a
+ test -f $l && echo $l && return 0
+ done
+}
+
+# Some utility functions
+# When bash 4 becomes ubiquitous, we can use ${//}, ${^^} and ${,,}
+uc () { echo "$*" | tr '[:lower:]' '[:upper:]'; }
+lc () { echo "$*" | tr '[:upper:]' '[:lower:]'; }
+subst () { echo "${1%%$2*}$3${1#*$2}"; }

0 comments on commit 118a3f4

Please sign in to comment.