add bash in current form
This commit is contained in:
commit
3065a9db72
5 changed files with 170 additions and 0 deletions
22
bash/.bash_functions
Normal file
22
bash/.bash_functions
Normal file
|
@ -0,0 +1,22 @@
|
|||
# vim: set ft=sh:
|
||||
|
||||
iploc () {
|
||||
curl -s "http://ip-api.com/json/${1}" | tr ',' '\n' | sed 's/[\"{}]//g'
|
||||
}
|
||||
|
||||
function parse_branch {
|
||||
scmexe=${1:-git}
|
||||
$scmexe branch 2> /dev/null | awk '/^*/{$1="";sub(/^ /, "");print "("$0")"}'
|
||||
}
|
||||
|
||||
function appendpath {
|
||||
if ! [[ "$PATH" =~ $1 ]]
|
||||
then
|
||||
PATH="$1:$PATH"
|
||||
fi
|
||||
export PATH
|
||||
}
|
||||
|
||||
yell() { echo "$0: $*" >&2; }
|
||||
die() { yell "$*"; exit 1; }
|
||||
try() { "$@" || die "failed while trying to: $*"; }
|
Loading…
Add table
Add a link
Reference in a new issue