Skip to content

Commit

Permalink
Fold util and auto add to cmd_path
Browse files Browse the repository at this point in the history
  • Loading branch information
akatrevorjay committed Apr 28, 2012
1 parent 28935e8 commit ca2afde
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bashism.d/util.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/bash

## -> b.split($by, $str)
## {{{ -> b.split($by, $str)
## If $by is empty, split by $IFS into array $ret
function bashism.util.split() {
ret=()
local IFS=${1:$IFS} i=; for i in ${@:2}; do
ret[${#ret[@]}]="$i"
done
}
## }}}

## -> b.util.is_function($name)
## {{{ -> b.util.is_function($name)
function bashism.util.is_function() { declare -f -F "$1" >/dev/null 2>&1; }
## }}}

bashism.cmd_path.push util

0 comments on commit ca2afde

Please sign in to comment.