Skip to content

Latest commit

 

History

History
78 lines (48 loc) · 1.03 KB

README.md

File metadata and controls

78 lines (48 loc) · 1.03 KB

Helpers

Collection of small shell helpers to make life easy.

Instalation

Just source it

ls -1 /home/ac/_work/projects/[email protected]/helpers/*sh | while read a; do
	echo "source $a">> $temphlp;
done;

Bash

hlp_bash_iterator

func1 | while read a; do
 func2  param1 $a
done
func1 | hlp_bash_iterator func2 param1

That is realy close to xargs with line separator, but I am more comfotable with while loop.

NOTE: Remember about subshell problem!

hlp_bash_fullpath

hlp_bash_fullpath file1

Equal to

echo "$(pwd)/file1"

hlp_while_false_or_timeout

Repeat command until it failed or timeout

hlp_until_false_or_timeout <command> <count default:1> <timeout default:1>

JSON

hlp_format_json

Make json looks nice.

cat 1.json | hlp_format_json

You need to install json.tool python module.

Misc

hlp_wget_recurcive

Recurcive get with wget

Usefull for files published over apache

hlp_wget_recurcive <url> <depth>