Hello,
I'm new to shell (.sh) scripting, so I lean slowly .
I have this command
This command retreive the name if ethernet interface from dmesg kernel journal, and works well when executed from the commande line prompt.
But error is given : not fount when trying to use it in a shell script
Here is the code of script
So please, tel me where is the problem.
The output is
I'm new to shell (.sh) scripting, so I lean slowly .
I have this command
Code:
$ dmesg | grep "Ethernet address:" | awk '{ print $1 }' | sed s/://
But error is given : not fount when trying to use it in a shell script
Here is the code of script
Code:
#!/bin/sh
#
# Get interface name & replace it.
#
# Get kernel if
Bsd_dmesg="/sbin/dmesg"
Bsd_grep="/usr/bin/grep"
Bsd_sed="/usr/bin/sed"
Bsd_awk="/usr/bin/awk"
# dmesg | grep \"Ethernet address:\" | awk '{ print $1 }' | sed s/://"
C_ifkern_cmd="${Bsd_dmesg}|${Bsd_grep} \"Ethernet address:\"| ${Bsd_awk} '{ print \$1 }' | ${Bsd_sed} s/://"
# execute command;
echo "${C_ifkern_cmd}"
ifnet=$("${C_ifkern_cmd}")
echo "${ifnet}"
exit 0
So please, tel me where is the problem.
The output is
Code:
./ucgetif: /sbin/dmesg|/usr/bin/grep "Ethernet address:"| /usr/bin/awk '{ print $1 }' | /usr/bin/sed s/://: not found