I got a table creation file in a standard format. I need to accept parameters from the user & then based on the input change the data in the file. For. eg.
i will accept the database name, dbspace name & user name from the user and accordingly change the same in the table creation file. Any ideas???.
Thanks in advance.
You can do this in many ways .
1. Pass the arguments on the command line and access values as $1 $2 etc from inside the script .
2. For a more descriptive solution you can use the
<script> -d <dbname> -u <username> and so on and access the values using the getopts command inside the script.
3. You can also store the configurable values in a file and read the file before invoking the table creation script.
Let me know if you need any further help
Thanks for your reply, can you pls. give me an eg. of it. I need to accept these parameters & based on the input reflect the changes in the other file(table creation file). My script would be -
<script> -d <dbname> -u <username> -dbs <dbspace>
can you give an eg of the above. At the prompt user will enter
<script> -d <dbname> -u <username> -dbs <dbspace> and based on the input i will change the table creation script using sed command. Thanks in advance.