jeudi 25 février 2016

Bash select random string from list

I have a list of strings that I want to select one of them at random each time I launch the script.

For example

SDF_BCH_CB="file1.sdf"
SDF_BCH_CW="file2.sdf"
SDF_BCH_RCB="file3.sdf"
SDF_BCH_RCW="file4.sdf"
SDF_TT="file5.sdf"

Then I want to be randomly select from the above list to assign the following two variables.

SDFFILE_MIN=$SDF_BCH_CW
SDFFILE_MAX=$SDF_TT

How can I do this ?

Thanks




Aucun commentaire:

Enregistrer un commentaire