linux - Why is echo showing the command itself and not the command output -
why echo showing command , not output of command once start using in loop? example command works
root@linux1 tmp]# iscsiadm -m node |awk '{print $1}' 192.168.100.88:326
but not in loop
[root@linux1 tmp]# in 'iscsiadm -m node | awk '{print $1}'';do echo $i;done iscsiadm -m node | awk {print }
i want command print first field can add other functionality loop. thanks
edit -- not sure why got voted down on question. please advise.
you're not executing iscsiadm
, awk
commands, because quoted it; makes literal string. substitute output of command command line, use $(...)
for in $(iscsiadm -m node |awk '{print $1}'); echo $i done
Comments
Post a Comment