we are handling Non Production servers where we need to create lot of users daily.

So the thing is after refreshing the Prod fix environment from Production we are end dating all the produciton users and we are creating the new users through sql script using FND create package where we have two scripts one for creating the user and 2nd for adding the responsibilites corresponding to the user in other script which are ran as a part of post refresh scripts.

So below are the few steps we are doing

1) login to server
2) pbrun
3) then going to the specific location where those two files are placed
4) taking the backup of those two files
5) then adding the new user creation script at the end of the file
6) Adding the name of the user in the non end dated command
7) Adding the responsibilites assinging commands to the second file

Now I want the following things

1) Need to create a unix script which when i will run first login to database using apps and asks for the number of usernames to be created newly
2) To check if those users exist already if yes then asking for other name
3) Creating the users at runtime and adding the same in the file after taking the current backup.
4) Asking for the list of responsibilities (can be provided in a flat file)
5) Need to add those responsibilities once at that time and adding the script to the second file after taking its backup.