diff options
| author | Karel Kočí <cynerd@email.cz> | 2018-06-15 16:30:20 +0200 | 
|---|---|---|
| committer | Karel Kočí <cynerd@email.cz> | 2018-06-15 16:30:20 +0200 | 
| commit | 7bfda5959a346626dac3aa0959f2b4ae3232249b (patch) | |
| tree | 0ee76b7e914a3fde9d109618c8e2b2599bcbe009 | |
| parent | f8dc9f95cdc95204eb34c8787e4c5410d7c59ff5 (diff) | |
| download | shellrc-7bfda5959a346626dac3aa0959f2b4ae3232249b.tar.gz shellrc-7bfda5959a346626dac3aa0959f2b4ae3232249b.tar.bz2 shellrc-7bfda5959a346626dac3aa0959f2b4ae3232249b.zip | |
Add function to generate random hex number
| -rw-r--r-- | shellrc.d/common | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/shellrc.d/common b/shellrc.d/common index 73707c5..7fc8047 100644 --- a/shellrc.d/common +++ b/shellrc.d/common @@ -47,6 +47,15 @@ genpasswd() {  	tr -dc A-Za-z0-9_ < /dev/urandom | head -c "$l" | xargs  } +# Generate random hex number of given lenght +genhex() { +	if [ -z "$1" ]; then +		echo "Size is required as first argument!" >&2 +		return 1 +	fi +	tr -dc 0-9A-F < /dev/urandom | head -c "$1" | xargs +} +  # Automatic branch merger (merge branch, push it to server and remove branch)  # Expects name of the branch as argument  gitbmerge() { | 
