![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to update values for the parameters | gmahesh2k | UNIX for Dummies Questions & Answers | 1 | 07-14-2008 10:53 PM |
| Positional parameters | shalu@ibm | UNIX for Dummies Questions & Answers | 2 | 11-22-2007 07:58 AM |
| Positional Parameters | ericelysia | UNIX for Dummies Questions & Answers | 15 | 10-23-2005 04:11 PM |
| Positional Parameters | Shell Programming and Scripting | 2 | 09-26-2003 02:51 PM | |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Resetting the Positional parameters values
Hi,
Can any one provide the Unix command to reset the positional parameters? Please see the below example where i have to pass 2 parameters to Shell1.sh. Step1) . ./Shell1.sh 2 3 successfully executed, Then i executed(next step only) the same shell script again,this time no parameters passed. Step 2) . ./Shell1.sh This is also successfully executed,because it considered(previous values) 2 & 3 as the positional parameters as i had not reseted them. Thanks in advance. |
|
||||
|
Hi zaxxon ,
How does the script know of the former parameters? As i know if we once assign the values to positional parameters those will be remain same until we reassign them.the same happened in my case also. Do you export them or write them to file? I am not exporting or not writing into a file. I am new to Unix & shell scripting, correct me if i am wrong correct me in above. Below is the content of Shell1.sh: if [ $# != 2 ] then echo "No Of Parameters passed not equal to 2" else echo $1 echo $2 echo "Completed" fi Below is the flow of execution & their output: . ./Shell1.sh 2 3 2 3 Completed . ./Shell1.sh 2 3 Completed The second time i need to get the output like "No Of Parameters passed not equal to 2", but it was not happened.This is the reason i need to know the command to reset the positional parameters, can u share the command if you know. Thanks for your help. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|