Generate a random filename in unix shell

前端 未结 14 677
说谎
说谎 2020-12-22 23:39

I would like to generate a random filename in unix shell (say tcshell). The filename should consist of random 32 hex letters, e.g.:

c7fdfc8f409c548a10a0a89a7         


        
14条回答
  •  天涯浪人
    2020-12-23 00:20

    uuidgen generates exactly this, except you have to remove hyphens. So I found this to be the most elegant (at least to me) way of achieving this. It should work on linux and OS X out of the box.

    uuidgen | tr -d '-'
    

提交回复
热议问题