Article 5NFKQ [SOLVED] set variable for the output

[SOLVED] set variable for the output

by
prayag_pjs
from LinuxQuestions.org on (#5NFKQ)
I have below output -

Code:[root@server]# cat /etc/passwd | awk -F ":" '{print $1}'
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
operator
games
ftp
nobody
systemd-bus-proxy
systemd-network
dbus
polkitd
tss
sshd
postfix
chrony
automatehub
mysql
prometheus
[root@server]#
Now I want to assign above output to variable via for loop something like this

Code:var1=root
var2=bin
.
.
.
varn=outpuntnI can think of only this solutions -

Code:[root@server]# for i in `cat /etc/passwd | awk -F ":" '{print $1}'` ; do var1=$i ;done
[root@server]# echo $var1
prometheus
[root@server]#But it gives only one variable. How to achieve this for multiple variables. Can someone can guide on how to achieve this?latest?d=yIl2AUoC8zA latest?i=qOR4u9GdkP8:J5ILl03mn98:F7zBnMy latest?i=qOR4u9GdkP8:J5ILl03mn98:V_sGLiP latest?d=qj6IDK7rITs latest?i=qOR4u9GdkP8:J5ILl03mn98:gIN9vFwqOR4u9GdkP8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments