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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -