in reply to CGI problem

You haven't shown us how $usr and $pwd are being set. Presumably, whatever you're doing to assign values to those variables, it behaves one way when it runs in your shell environment, and behaves some other way when it runs via the web server.