几乎所有Unix和类Unix环境中都包含了一个名为uuidgen的小工具,运行即可生成一个UUID。
#include
#include <uuid/uuid.h>
int main(int argc, char **argv)
{
uuid_t uuid;
uuid_generate(uuid);
unsigned char *p = uuid;
int i;
for (i = 0; i < sizeof(uuid_t); i++, p++)
{
printf("%02x", *p);
}
printf("\n");
return 0;
}
https://blog.csdn.net/huanggang982/article/details/9109847
UUID=$(uuidgen |sed ‘s/-//g’)
echo $UUID
https://blog.csdn.net/fishinhouse/article/details/104204745?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_v2~rank_aggregation-1-104204745.pc_agg_rank_aggregation&utm_term=shell+%E7%94%9F%E6%88%90uuid&spm=1000.2123.3001.4430