mercredi 3 mai 2017

BASH - assign values to variables

openSuSE 13.2

I'm trying to assign a random value to rand and the MAC Address of the interface to mac

I've tried the following, but they didn't seem to work.

rand=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)

eth=$(<ifconfig eth0 | awk '/HWaddr/ {print $5}')

Any ideas how to do this ?

Thanks




Aucun commentaire:

Enregistrer un commentaire