I need to run a few commands from terminal via a TCL script. This TCL script works fine.
set cmd_list [list {mkdir testdir} {cd testdir} ]
set dataportInterface "eth0"
lappend cmd_list [list ifconfig -a | grep -m 1 $dataportInterface]
However, as soon as I add the awk command, it starts failing. Error is "Failed : extra characters after close-brace".
lappend cmd_list [list ifconfig -a | grep -m 1 $dataportInterface | awk 'BEGIN {FS="[:]"} { print $1 } END {}' | xargs -t ethtool -S]
I have tried several possibilities, but none of them work. For example, if I try
lappend cmd_list { }
then, $dataportInterface's value eth0 is not taken.
I tried putting a \ in front of all special characters (: " ' [ { and that threw the error $1 not recognized. I put the awk command in {{ brackets and that didn't work either. (error: doesn't recognize {{awk)
What is the correct way to go about this, and why?
ifconfig ...command in{...}?$dataportInterfaceis not changed to eth0. However, if I hardcodeeth0, it works. (But that's not what I'm looking for)]after$dataportInterfacein thatifconfigcommand.]. That was a SO typo.