-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuuidgen
34 lines (24 loc) · 948 Bytes
/
uuidgen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# example uuid: 7d80649a-bf90-4427-af9a-11c569545d25
HEX_DATA=$(cat /dev/urandom|head -c 512|xxd -ps -c 1)
# C1
A1=$(echo $HEX_DATA|awk '{print $1}')
A2=$(echo $HEX_DATA|awk '{print $2}')
A3=$(echo $HEX_DATA|awk '{print $3}')
A4=$(echo $HEX_DATA|awk '{print $4}')
A5=$(echo $HEX_DATA|awk '{print $5}')
A6=$(echo $HEX_DATA|awk '{print $6}')
A7=$(echo $HEX_DATA|awk '{print $7}')
A8=$(echo $HEX_DATA|awk '{print $8}')
A9=$(echo $HEX_DATA|awk '{print $9}')
A10=$(echo $HEX_DATA|awk '{print $10}')
A9=$(echo $HEX_DATA|awk '{print $9}')
A10=$(echo $HEX_DATA|awk '{print $10}')
A11=$(echo $HEX_DATA|awk '{print $11}')
A12=$(echo $HEX_DATA|awk '{print $12}')
A13=$(echo $HEX_DATA|awk '{print $13}')
A14=$(echo $HEX_DATA|awk '{print $14}')
A15=$(echo $HEX_DATA|awk '{print $15}')
A16=$(echo $HEX_DATA|awk '{print $16}')
# OUT UUID
printf "${A1}${A2}${A3}${A4}-${A5}${A6}-${A7}${A8}-${A9}${A10}-${A11}${A12}${A13}${A14}${A15}${A16}\n"