Skip to content

Instantly share code, notes, and snippets.

@sayz
Created May 11, 2013 16:14
Show Gist options
  • Select an option

  • Save sayz/5560414 to your computer and use it in GitHub Desktop.

Select an option

Save sayz/5560414 to your computer and use it in GitHub Desktop.
change mac
#!/bin/bash
macs=$(cat "$MAC_FILE")
if [ "$#" -lt 1 ]
then
# No arguments. List available macs
echo "$macs"
else
IFS=$'\n'
for m in $macs
do
name=$(echo "$m" | cut -d ' ' -f 1)
mac=$(echo "$m" | cut -d ' ' -f 2)
if [ "$name" = "$1" ]
then
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether "$mac"
sudo ifconfig eth0 up
break
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment