Read through a file and Pass system commands

Hi,

I have a file xyz.txt, which contains several "tar.gz" package names

Eg :-

Now i need to execute an rpm - ivh against all those packages in this file through a script one by one.

I need a script to read through the file "xyz.txt", pick up each package name and execute rpm -ivh <package name> against each one by one.

any leads how this can be done ?

Thanks

cat xyz.txt|while read line
do
rpm -ivh $line
done

Gaurav

That cat is a UUOC.

while read line
do
rpm -ivh $line
done < xyz.txt

hi vino,

can you please tell me what is UUOC

Regards,
Gaurav

Thanks for that gaurav :)...

See this - UUOC

Thanks a lot vino,

systemali use the code given by vino as it is more elegant and optimized

Gaurav

Done that Gaurav :slight_smile:

Vino is a valuable asset here at unix.com ....:slight_smile: