env variable mac address script problems

Discussion in 'Programming/Scripts' started by schris403, Aug 1, 2007.

  1. schris403

    schris403 New Member

    I have been trying for days to try and get the following script to load the mac variable upon boot in the rc.local file and just can't seem to get it to work. It does work when I manually run the line but when I run it as a normal sh script, it doesn't work.

    mac=`ifconfig -a eth0 | grep "HWaddr" | cut -d " " -f 11` | tr -s : .

    Maybe there is a different way of accomplishing this, all I want is a variable with my eth0 mac address with . instead of : seperating them. Any help would be greatly appreciated.

    Thanks so much!!

  2. falko

    falko Super Moderator ISPConfig Developer

    Have you tried to use the full paths for ifconfig, grep, cut, and tr in your script?
  3. gymno

    gymno New Member

    I agree with previous post ensure you have the correct path names.

    However, when I tried the command in bash it didn't work.

    I did get this to work:

    ifconfig | grep "HWaddr" | cut -d" " -f11 | tr -s ":" "."

    and that seemed to get the job done.


Share This Page