# wrapper for another script



## da1 (Jan 15, 2011)

Hi guys,

I have a script (that I cannot alter) that registers some stuff into a database. It needs 2 switches and after I launch it, it asks for a usr name and a pass. The problem is that I need to register 60+ entries with that script.

My idea is to create some wrapper that will read my usr/pass once, and pass it along to the initial script.

This is what I've done so far ("multireg.sh):

```
#!/usr/bin/ksh

if [[ -z $1 ]];then
echo "You must supply at least 1 nodeID as an argument."
exit 1
fi

echo "Input instance name:"
read instance
echo "Input username:"
read username
echo "Input password"
stty -echo
read pass
stty echo

cd /root/scripts/
for i in $*
do
./register_client.sh -n $instance -sn $i
read id
echo $id
done
```

The register_client.sh is the culprit and the wrapper (multireg.sh) should be launched like [CMD=""]./multireg.sh 1 2 3 4 5 etc[/CMD]. 

For each argument, the wrapper should know how to read and write the 2 inputs the initial script needs, which are 
	
	



```
id:
pass:
```
 but I have a tough time understanding how to do this.

Can anyone help ?


----------

