aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorMiloslav Trmac <mitr@volny.cz>2006-07-26 02:03:42 +0000
committerMiloslav Trmac <mitr@volny.cz>2006-07-26 02:03:42 +0000
commitad98e4eaac64a44263fc4e79933f8c33603a9f3e (patch)
tree4cc676b128a1ce5e594d7259f843adabb4e713d6 /sysconfig
parent17e3ac8cbb2a1baa012f2f26ed6b83f9ce769eac (diff)
downloadinitscripts-ad98e4eaac64a44263fc4e79933f8c33603a9f3e.tar
initscripts-ad98e4eaac64a44263fc4e79933f8c33603a9f3e.tar.gz
initscripts-ad98e4eaac64a44263fc4e79933f8c33603a9f3e.tar.bz2
initscripts-ad98e4eaac64a44263fc4e79933f8c33603a9f3e.tar.xz
initscripts-ad98e4eaac64a44263fc4e79933f8c33603a9f3e.zip
Avoid an unnecessary cat / sed.
Diffstat (limited to 'sysconfig')
-rw-r--r--sysconfig/network-scripts/network-functions18
1 files changed, 8 insertions, 10 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 462d141c..733215a1 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -9,16 +9,14 @@ export PATH
get_hwaddr ()
{
- {
- if [ -f /sys/class/net/${1}/address ]; then
- cat /sys/class/net/${1}/address
- elif [ -d "/sys/class/net/${1}" ]; then
- LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
- sed 's/.*link\/[^ ]* \([[:alnum:]:]*\).*/\1/'
- fi
- } | \
- awk '{ print toupper($0) }'
-}
+ if [ -f /sys/class/net/${1}/address ]; then
+ awk '{ print toupper($0) }' < /sys/class/net/${1}/address
+ elif [ -d "/sys/class/net/${1}" ]; then
+ LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
+ awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/,
+ "\\1", 1)); }'
+ fi
+}
get_config_by_hwaddr ()
{