Generate a random filename in unix shell

前端 未结 14 735
说谎
说谎 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:12

    If you have openssl in your system you can use it for generating random hex (also it can be -base64) strings with defined length. I found it pretty simple and usable in cron in one line jobs.

     openssl rand -hex 32
     8c5a7515837d7f0b19e7e6fa4c448400e70ffec88ecd811a3dce3272947cb452
    

提交回复
热议问题