Hi all,
I am operating in a Korn Shell, and attempting to run a simple chdb script I wrote. If run with no arguments, it prompts the user with a list of databases and waits for a selection. If called with a single numeric argument, it will automatically make the selection for the user.
Example:
> . chdb
Select the database sid from the following:
1) testdb1
2) testdb2
3) testdb3
Selection: 2 <-- user entered
Environment is now set up for testdb2.
>. chdb 2
Environment is now set up for testdb2.
>
My problem is that when I run the script with an argument as above, and then try to run it again with no arguments, it still uses the old arguments.
Example:
> . chdb 2
Environment is now set up for testdb2.
> . chdb
Environment is now set up for testdb2.
>
EDIT: I am using the dot because I am setting variables in the environment and do not want to invoke a child shell instance, otherwise the database setup won't work. I have a feeling this may be the source of my problem, but I am not sure how to work around it.
One other thing that might be worth mentioning is that calling my script with at least 1 argument will always work as intended. It never uses previously entered arguments unless it is invoked with no parameters.