command line error with substrings "bad sustitution"
Posted: Sat Mar 16, 2013 8:42 pm
Hope that you continue believing that there are note supid questions, Iḿ newbie.
linux Mint 14 mate, 32 bits, installed on a pendrive.
I am trying to get the mac address fron ifconfig comand.
command--> mac=${(ifconfig wlan0 |grep HWaddr):38:19}
linux --> bash: ${(ifconfig wlan0 |grep HWaddr):38:19}: bad substitution
if I do it in two steps it works fine.
mint@mint ~ $ a=$(ifconfig wlan0 |grep HWaddr)
mint@mint ~ $ b=${a:38:19}
mint@mint ~ $ echo $b
xx.xx.xx.xx.xx.xx
I am sure that this question is a bit stupid, at least. But I can not find where the problem. I tested whit little variations and the problem is the same.
any help will be apreciated.
Jose
linux Mint 14 mate, 32 bits, installed on a pendrive.
I am trying to get the mac address fron ifconfig comand.
command--> mac=${(ifconfig wlan0 |grep HWaddr):38:19}
linux --> bash: ${(ifconfig wlan0 |grep HWaddr):38:19}: bad substitution
if I do it in two steps it works fine.
mint@mint ~ $ a=$(ifconfig wlan0 |grep HWaddr)
mint@mint ~ $ b=${a:38:19}
mint@mint ~ $ echo $b
xx.xx.xx.xx.xx.xx
I am sure that this question is a bit stupid, at least. But I can not find where the problem. I tested whit little variations and the problem is the same.
any help will be apreciated.
Jose