[Ilugc] Shell script with arguments

  • From: benignbala@xxxxxxxxx (Balachandran Sivakumar)
  • Date: Tue, 17 Jul 2012 18:13:41 +0530

Hi,

On Tue, Jul 17, 2012 at 5:57 PM, Vijay Kumar <vijayakumarnkdr at 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: benignbala at gmail.com
Blog: http://benignbala.wordpress.com/

Other related posts: