Am 10. Feb, 2005 schwätzte Craig White so: > On Thu, 2005-02-10 at 22:32 -0800, Jeremy C. Reed wrote: > > On Thu, 10 Feb 2005, Craig White wrote: > > > > > if $USERADMIN_ACTION=ADD_USER; then > > > > A couple problems. > > > > Add spaces around the equal sign. > > > > But then the shell will still evaluate and run the first value. > > > > Use test or [. > > > > man [ > > > > if [ "${USERADMIN_ACTION}" = "ADD_USER" ]; then > ---- > I guess I'm not so embarrassed after all, my O'Reilly Bash book doesn't > seem to cover those details. > > I get the [ ] for the test > I don't get the braces around the variable but it definitely works They denote the actual variable name for when it's not obvious. ${myvar}withstuffaddedonit I also suggest switching the args in the test. if [ 'ADD_USER' = "${USERADMIN_ACTION}" ]; then That helps keep from getting silent errors when you use assignment operators rather than comparison operators. You can use single quotes on strings because you don't need to evaluate anything. > Now - my last problem > > if you recall, I am 'exec' a perl file but the variable $LDAPADMIN_USER > isn't getting passed to it. I thought that if I used exec > exec '/root/scripts/ldap_useradmin.delmail.pl' > instead of just > /root/scripts/ldap_useradmin.delmail.pl I think those two lines are essentially the same, except the one using exec unnecessarily starts yet another process. > it would get passed automatically. I added a line > export $LDAPADMIN_USER No '$', just "export LDAPADMIN_USER". lufthans@dth:~$ bash lufthans@dth:~$ echo $fred lufthans@dth:~$ fred=anke lufthans@dth:~$ export $fred lufthans@dth:~$ bash lufthans@dth:~$ echo $fred lufthans@dth:~$ exit lufthans@dth:~$ export fred lufthans@dth:~$ bash lufthans@dth:~$ echo $fred anke Still you should setup perl to take the parameter as a command line argument. Use my getopts.pl to get a leg up on parsing command line args :). https://www.LuftHans.com/unix/ ciao, der.hans -- # https://www.LuftHans.com/ http://www.AZOTO.org/ # "Every person who has mastered a profession is a skeptic concerning it." # -- George Bernard Shaw --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss