linuxbashguid

Linux command to generate new GUID?


I need to generate a new GUID through a bash script.

I already done that by using a python script, based on: here

#! /usr/bin/env python
import uuid
print str(uuid.uuid1())

But I need to copy this script into any new system that I work on. So, I want to use Bash instead.


Solution

  • Assuming you don't have uuidgen, you don't need a script:

    $ python -c 'import uuid; print(str(uuid.uuid4()))'
    b7fedc9e-7f96-11e3-b431-f0def1223c18