Parse of method flags.
[SquirrelJME.git] / utils-dev / uuid.sh
blob2fb2f114ef7f6c836a01d8003ad1b895e4eaf9ec
1 #!/bin/sh
2 # ---------------------------------------------------------------------------
3 # Multi-Phasic Applications: SquirrelJME
4 # Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 # Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
6 # ---------------------------------------------------------------------------
7 # SquirrelJME is under the GNU General Public License v3, or later.
8 # See license.mkd for licensing and copyright information.
9 # ---------------------------------------------------------------------------
10 # DESCRIPTION: Creates a UUID.
12 # Force C locale
13 export LC_ALL=C
15 # Directory of this script
16 __exedir="$(dirname -- "$0")"
18 # One UUID command?
19 if which uuidgen 2>&1 > /dev/null
20 then
21 uuidgen
23 # Another command
24 elif which uuid 2>&1 > /dev/null
25 then
26 uuid
28 # Otherwise make something up, use random data source
29 else
30 __num="$("$__exedir/random.sh" 16)"
31 echo "$__num" | \
32 sed 's/\(.\{8\}\)\(....\)\(....\)\(....\)\(.\{12\}\)/\1-\2-\3-\4-\5/g'