How to install multiple RPM packages using Shell script and by taking it from comma separated input file?...
I have to install multiple packages using shell script and rpm (package) name is in the input file.
I have done it in this below way.
My input file is path is = /mstr/mstr_input_file.txt
MY Script is:
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.
My input file contains:
packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2
linux shell-script amazon-linux
closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I have to install multiple packages using shell script and rpm (package) name is in the input file.
I have done it in this below way.
My input file is path is = /mstr/mstr_input_file.txt
MY Script is:
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.
My input file contains:
packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2
linux shell-script amazon-linux
closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Is it Okay Now?
– Santosh Garole
Feb 22 at 10:02
Please don't post screenshots of text
– Olorin
Feb 27 at 7:08
add a comment |
I have to install multiple packages using shell script and rpm (package) name is in the input file.
I have done it in this below way.
My input file is path is = /mstr/mstr_input_file.txt
MY Script is:
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.
My input file contains:
packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2
linux shell-script amazon-linux
I have to install multiple packages using shell script and rpm (package) name is in the input file.
I have done it in this below way.
My input file is path is = /mstr/mstr_input_file.txt
MY Script is:
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.
My input file contains:
packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2
linux shell-script amazon-linux
linux shell-script amazon-linux
edited Feb 22 at 10:06
Kusalananda
134k17255418
134k17255418
asked Feb 20 at 10:16
Santosh GaroleSantosh Garole
62
62
closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Is it Okay Now?
– Santosh Garole
Feb 22 at 10:02
Please don't post screenshots of text
– Olorin
Feb 27 at 7:08
add a comment |
Is it Okay Now?
– Santosh Garole
Feb 22 at 10:02
Please don't post screenshots of text
– Olorin
Feb 27 at 7:08
Is it Okay Now?
– Santosh Garole
Feb 22 at 10:02
Is it Okay Now?
– Santosh Garole
Feb 22 at 10:02
Please don't post screenshots of text
– Olorin
Feb 27 at 7:08
Please don't post screenshots of text
– Olorin
Feb 27 at 7:08
add a comment |
3 Answers
3
active
oldest
votes
I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.
First do:
for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done
if the output shows a the packages now line by line it should work with:
for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done
Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)
add a comment |
You can use:
yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)
awk
command will give packages names separated by space as input to yum.
add a comment |
You could use xargs
to feed comma separated values to a command:
xargs -d',' yum install < inputfile.csv
If you want to install the packages one by one, you could pass the -n 1
flag to xargs:
xargs -n1 -d',' yum install < inputfile.csv
<
sends the input file to xargs
xargs -d','
takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.
You can find and split the lines starting with packagelist
with awk
:
</mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.
First do:
for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done
if the output shows a the packages now line by line it should work with:
for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done
Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)
add a comment |
I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.
First do:
for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done
if the output shows a the packages now line by line it should work with:
for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done
Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)
add a comment |
I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.
First do:
for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done
if the output shows a the packages now line by line it should work with:
for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done
Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)
I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.
First do:
for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done
if the output shows a the packages now line by line it should work with:
for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done
Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)
edited Feb 20 at 10:40
answered Feb 20 at 10:34
Dorian GaensslenDorian Gaensslen
315
315
add a comment |
add a comment |
You can use:
yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)
awk
command will give packages names separated by space as input to yum.
add a comment |
You can use:
yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)
awk
command will give packages names separated by space as input to yum.
add a comment |
You can use:
yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)
awk
command will give packages names separated by space as input to yum.
You can use:
yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)
awk
command will give packages names separated by space as input to yum.
edited Feb 20 at 10:44
answered Feb 20 at 10:21
PRYPRY
2,61231026
2,61231026
add a comment |
add a comment |
You could use xargs
to feed comma separated values to a command:
xargs -d',' yum install < inputfile.csv
If you want to install the packages one by one, you could pass the -n 1
flag to xargs:
xargs -n1 -d',' yum install < inputfile.csv
<
sends the input file to xargs
xargs -d','
takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.
You can find and split the lines starting with packagelist
with awk
:
</mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
add a comment |
You could use xargs
to feed comma separated values to a command:
xargs -d',' yum install < inputfile.csv
If you want to install the packages one by one, you could pass the -n 1
flag to xargs:
xargs -n1 -d',' yum install < inputfile.csv
<
sends the input file to xargs
xargs -d','
takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.
You can find and split the lines starting with packagelist
with awk
:
</mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
add a comment |
You could use xargs
to feed comma separated values to a command:
xargs -d',' yum install < inputfile.csv
If you want to install the packages one by one, you could pass the -n 1
flag to xargs:
xargs -n1 -d',' yum install < inputfile.csv
<
sends the input file to xargs
xargs -d','
takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.
You can find and split the lines starting with packagelist
with awk
:
</mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install
You could use xargs
to feed comma separated values to a command:
xargs -d',' yum install < inputfile.csv
If you want to install the packages one by one, you could pass the -n 1
flag to xargs:
xargs -n1 -d',' yum install < inputfile.csv
<
sends the input file to xargs
xargs -d','
takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.
You can find and split the lines starting with packagelist
with awk
:
</mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install
edited Feb 22 at 11:06
answered Feb 20 at 10:36
ctxctx
1,644414
1,644414
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
add a comment |
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
In my Input file So many inputs are there not only rpm Packages
– Santosh Garole
Feb 22 at 10:01
add a comment |
Is it Okay Now?
– Santosh Garole
Feb 22 at 10:02
Please don't post screenshots of text
– Olorin
Feb 27 at 7:08