|
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.
|