OK, I'm hoping I understand this correctly. Also my solution is with bash but -should- work with ksh as well
You want it so that when you run this script and select an option, it then sets that profile for the current bash session? If so you'll need to run the script slightly differently than usual.
When you run a bash script, anything that happens inside it, stays inside it so that it doesn't affect the outside session or anything else
So if you want to change the current user's profile from within a bash script, you will need to run the bash script as
source <name of script>
rather than
./<name of script>
As you might usually call it.
Try it and let me know if it works, if not I'll try to help more
. ./profile1;;
..profile
? If you're not calling it with. ./script
- i.e. sourcing it, the sourcing of the.profile1
or.profile2
can't take effect in the current shell.