LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Change postional parameter (https://www.linuxquestions.org/questions/linux-general-1/change-postional-parameter-648211/)

mamtasahai1 06-10-2008 01:57 AM

Change postional parameter
 
Hi... I m using RHEL5. As by Redhat Linux Positional parameters are from $0 - $9. Is there any way to increase this for ex. $0 - $ 15.
Please give me the file associated with positional parameter.
Thanks in advance.....

pixellany 06-10-2008 06:43 AM

You are talking about BASH syntax....it is not specific to RedHat (or any other distro)

There are several good books on BASH---eg "BASH Guide for Beginners" and "The Advanced BASH Scripting Guide"(ABS)---both free at tldp.org. I recommend downloading ABS and using it for searches.

From ABS: $1 - $9 = positional parameters #1-9
${10} = positional parameter #10

I don't know how high you can go ( I tried 13 and it worked)

Quote:

Please give me the file associated with positional parameter.
I don't know what you mean by this--eg documentation (see above). If you mean a file in the OS, then I don't think there is such a thing. The parameters are passed to a command in a memory stack---they would only get into a file if you put them there.

chrism01 06-10-2008 07:28 PM

See this page http://www.tldp.org/LDP/abs/html/othertypesv.html
By default the normal limit is 10 params (0-9).
If you want to go beyond that, you can use ${10}, ${11} etc or the old school way, use the 'shift' cmd, see sect 4.7 on that page.


All times are GMT -5. The time now is 10:08 AM.