LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Script accept unlimited number of options. (https://www.linuxquestions.org/questions/linux-newbie-8/script-accept-unlimited-number-of-options-187896/)

chii-chan 05-31-2004 02:35 AM

Script accept unlimited number of options.
 
Hi!

When you want the script to accept option you would do this something $1 right?

For example for a 'called remove':

#!/bin/bash

rm -i $1

Then execute it to remove files:

remove file file2

The script would remove the file given in the first option only right, so I add

#!/bin/bash

rm -i $1 $2

so that the script can remove the second file, but the process would be endless.

How do I have the script to accept unlimited number of options? Thanks.

david_ross 05-31-2004 03:21 AM

The variable "$@" will contain all of the parameters passed to a bash script.

chii-chan 05-31-2004 05:40 AM

Thanks! I thought that I need to make some kind of loop for it! My script works now.

sibu_rajappan 06-02-2004 07:27 AM

hello chii-chan..........

do u remember me.................i was the one who asked for the repair of gnome and u told me to remove all the gnome files.......now i have done it but nothing like u said happened ....like the gnome is not been recreated..............

i dont have a gui now .........pls help...........

i am using rh9

chii-chan 06-02-2004 08:54 AM

Can you go back to the original post. I'll answer your question there.


All times are GMT -5. The time now is 07:52 AM.