[Ilugc] Shell script with arguments
Hi All, I need some help/ideas in coming up with a shell script. Basically, the script should install 1 or 2 or 3 packages based on the input arguments. For example, if I type in pkgscript.sh a1 a2 a3, it should install all the 3 scripts and pkgscript.sh a1 should install only a1. If a user enters only pkgscript.sh, it should ask for arguments and then proceed accordingly. Thanks in advance. -- With regards, G. Vijayakumar, ___ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] Shell script with arguments
On Tue, 2012-07-17 at 17:57 +0530, Vijay Kumar wrote: For example, if I type in pkgscript.sh a1 a2 a3, it should install all the 3 scripts and pkgscript.sh a1 should install only a1. If a user enters only pkgscript.sh, it should ask for arguments and then proceed accordingly. does not yum or apt-get do this? -- regards Kenneth Gonsalves ___ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] Shell script with arguments
Hi, On Tue, Jul 17, 2012 at 5:57 PM, Vijay Kumar vijayakumarn...@gmail.com wrote: Hi All, I need some help/ideas in coming up with a shell script. For example, if I type in pkgscript.sh a1 a2 a3, it should install all the 3 scripts and pkgscript.sh a1 should install only a1. Use $# and $@. A rough outline is : if [[ $# == 0 ]]; then do something fi for pkg in $@ do install ${pkg} done Please read up on bash programming. This will be covered there. thanks -- Thank you Balachandran Sivakumar Arise Awake and stop not till the goal is reached. - Swami Vivekananda Mail: benignb...@gmail.com Blog: http://benignbala.wordpress.com/ ___ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] Shell script with arguments
On Tue, Jul 17, 2012 at 2:27 PM, Vijay Kumar vijayakumarn...@gmail.comwrote: Hi All, I need some help/ideas in coming up with a shell script. Basically, the script should install 1 or 2 or 3 packages based on the input arguments. For example, if I type in pkgscript.sh a1 a2 a3, it should install all the 3 scripts and pkgscript.sh a1 should install only a1. If a user enters only pkgscript.sh, it should ask for arguments and then proceed accordingly. you can find it here. http://codelectron.com/blog/38-bash-script-command-line-iterator-to-install-batch-of-apps -Krishna ___ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc