This works: mac=$(ifconfig eth0 | grep -Eo '..:..:..:..:..:..' | sed -e 's/://g')
.. but I'm sure there's a better way. Suggestions?
Also, if I have something like: echotemplate="This is my MAC: (MAC)" mac=$(ifconfig eth0 | grep -Eo '..:..:..:..:..:..' | sed -e 's/://g') echo $(echo $echotemplate | sed -e "s/(MAC)/$mac/")
.. is there a better way to do the substitution in the last line? I can't swap the top two lines around (one is a user-defined setting at the top of the script, the value of $mac is calculated in the body of the script), otherwise I would just use echo "This is my MAC: $mac" .. which would be nice and easy! But I'm using this as a learning exercise.