• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Question on "Which" command

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
0
jfz2004
Asked:
jfz2004
1 Solution
 
brettmjohnsonCommented:
I suspect that the 'which' command has been aliased.  You can check for this by doing:

alias | grep which

0
 
ravenplCommented:
or try: /usr/bin/which which
0
 
jfz2004Author Commented:
I did a alias | grep which, it shows nothing;

also, my /usr/bin does not have which.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jfz2004Author 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?
0
 
brettmjohnsonCommented:
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.
0
 
jfz2004Author Commented:
Thanks,
I checked my .cshrc and run every line in my .cshrc and I don't see any problem.
 

Jennifer
0
 
jfz2004Author 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.

0
 
ahoffmannCommented:
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
0
 
jfz2004Author Commented:
Hi, I resolved it by commemting out most of the lines in my .cshrc and
that problem disappeared.

Thanks.

Jennifer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now