On Sun, Nov 22, 2009 at 06:14:56PM +0800, ???? wrote: > run the command "drcomd" ,successful! > > but run command "sudo drcomd" ,return "sudo : drcomd: command not found"
Not really a bash bug. > under both (fedora)the PATH is > /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin > it's really confusing!!! What it sounds like to me, is that the "drcomd" command is in your PATH when you login, but is not in the PATH that sudo uses, which I presume is different. First, you should find out where the command actually is, by doing: type -p drcomd Then you might find it instructive to see what PATH sudo uses, by doing: sudo bash -c 'echo $PATH' If I'm correct, you'll discover that the directory which contains drcomd is not in the sudo PATH. Configuring sudo to use a different PATH is a bit outside the scope of a bash bug mailing list. Depending on what OS and/or distribution you're on, and what version of sudo you're using, there might be a line in /etc/sudoers which is setting sudo's PATH, or there might have been a compile-time override (Debian calls this "the SECURE_PATH build option"). Take a look at sudoers(5) and look for the "secure_path" option. I think that's what you want to set. If you can't figure out how to configure sudo according to your needs, then you could always use this: sudo "$(type -p drcomd)" It's inconvenient, but it'll probably work.