Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 1st August 2007, 04:07
schris403 schris403 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default env variable mac address script problems

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!!

Chris
Reply With Quote
Sponsored Links
  #2  
Old 2nd August 2007, 17:28
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,745 Times in 2,578 Posts
Default

Have you tried to use the full paths for ifconfig, grep, cut, and tr in your script?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 3rd August 2009, 23:35
gymno gymno is offline
Junior Member
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default RE: env variable mac address script problems

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.

Cheers,
gymno
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sending e-mail using mail() function linuxuser1 HOWTO-Related Questions 38 21st April 2009 12:20
apache2 problem laser144 Server Operation 8 15th March 2007 17:32
MAC address muzica Server Operation 5 12th March 2007 12:56
Can IPCop bandwidth throttle/shape by subnet, user or mac address? Merp HOWTO-Related Questions 3 15th July 2006 13:29
Ethereal Trouble mcrosby Installation/Configuration 8 25th June 2006 03:50


All times are GMT +2. The time now is 22:59.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.