Create A Unique File Name Using A MAC Address

Standard

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"`
MAC=$5

So if you run that command then do

echo $MAC

you’ll get something like this:

00-16-3E-11-09-20

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Leave a Reply