Create A Unique File Name Using A MAC Address


I needed a scheme to generate file names coming from different locations to a central server. The file names are generated in a script and I didn’t want to have to change the script for different locations. So I decided to include the MAC Address of the machine in the file name.

This little script grabs the address and converts the : characters to a – and stores there result in a var called MAC.

set - `ifconfig | grep -B 1 inet | head -1 | sed -e "s/\:/-/g"`

So if you run that command then do

echo $MAC

you’ll get something like this:


[Slashdot] [Digg] [Reddit] [] [Facebook] [Technorati] [Google] [StumbleUpon]