We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Question on "Which" command

jfz2004
jfz2004 asked
on
Medium Priority
290 Views
Last Modified: 2010-04-21
Hi,

on my unix command line, I typed "which meter" to try to
find out the path of "meter?, the result is:

% which meter
a: Command not found.
a: Command not found.
ora: No such file or directory


What's wrong with it? I don't know how and why "a" and "ora" appear above.

Could any one help me to remove these abnormality?
Thanks,

Jennifer
Comment
Watch Question

Top Expert 2005

Commented:
I suspect that the 'which' command has been aliased.  You can check for this by doing:

alias | grep which

Top Expert 2005

Commented:
or try: /usr/bin/which which

Author

Commented:
I did a alias | grep which, it shows nothing;

also, my /usr/bin does not have which.

Author

Commented:
Then I did /usr/ucb/which and I got this:

/usr/ucb/which which
a: Command not found.
a: Command not found.
/usr/ucb/which


By the way, when I open a new xterm, I got:
a: Command not found.
a: Command not found.

in the new xterm. But no "ora: command not found".
Why?
Top Expert 2005
Commented:
Ah.  It sounds like something invalid in your .profile, .cshrc. .tcshrc, or .bashrc (depending on your default shell).
Each time you start up a new shell, these get executed.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thanks,
I checked my .cshrc and run every line in my .cshrc and I don't see any problem.
 

Jennifer

Author

Commented:
Also, I only have .cshrc in my home directory. When I source .cshrc,
I don't have the :

a: Command not found.
a: Command not found.

as output.

which sources the shell's profile (see brettmjohnson's comment), hence it is unreliable to find what actually will be your "meter".
As it reports errors in your case, you most likely have a resource file (profile) which violates your shell settings, somehow in conjuntion with which ... (the reason why which is unreliable:).

Try following:
   echo $PATH|awk -F: '{for(i=1;i<=NF;i++){print "ls "$i"/meter"}}'|sh

Author

Commented:
Hi, I resolved it by commemting out most of the lines in my .cshrc and
that problem disappeared.

Thanks.

Jennifer
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.