So I like to set a new, randomly-generated MAC address after every restart using
ruby -e 'print ("%02x"%((rand 64)*4|2))+(0..4).inject(""){|s,x|s+":%02x"%(rand 256)} + "\n"'
and then copy/pasting the output after the command
sudo ifconfig en0 ether
so that I get a new IP address from my ISP each day. I would like to further automate this process so that on startup my computer automatically runs these two commands, but I don't know enough about CLI syntax to make it work. How can I combine these two commands so that ifconfig
takes the generated output of the ruby
command in a single step? And then, how can I get that to automatically run at startup?
Thank you.