Shell script to execute commands in individual users' home directories

Hi,

I am trying to write a shell script which execute certain commands within certain folders in each user's home directories

I started off with a bash script -

#!/bin/csh -f
su -l cvsusr1
cvs -d /home/cvsadm/repository status 

But the shell script finishes immediately after executing the switch command su.

Please suggest how I can proceed.

Regards,
Rupa

You know that this isn't a bash shell script, but a C shell script?

Aside from that, as soon as you run

su -l <user>

the users shell is executed as a login shell, which means it's in interactive mode, and won't exit until told to do so. If you want to run a command as another user, use

su -l <user> -c <command>

This will start a login shell for the specified user, and pass the command to it to run. The shell will then exit afterwards. If you need to run more than one command, put them into a separate script and run that via su.