Sponsored Content
Full Discussion: Need some help with this...
Top Forums Programming Need some help with this... Post 302138381 by Legend986 on Monday 1st of October 2007 10:46:04 AM
Old 10-01-2007
I was trying to refine my program. So I was just changing the order. I mean when something like ./uwhich -r ls is passed, it has to display the alias as well as the path to ls. It was displaying in the reverse order i.e. first path and then alias so i just interchanged the if logic by putting if(readalias == 1) first and if(allpaths == 1) as second one. But now, the second if loop is not displaying anything. I mean it is entering the loop but nothing is happening. Could I be doing something wrong here?

And as a matter of fact, if I want to find the particular command not just using the $PATH environment variable but in the whole system, is there any other variable for that? I mean, I should be able to get the variable wherever it is.

Last edited by Legend986; 10-01-2007 at 12:11 PM..
 
which(1)							   User Commands							  which(1)

NAME
which - locate a command and display its pathname or alias SYNOPSIS
which [name]... DESCRIPTION
which takes a list of names and determines which alias or utility would be executed had these names been given as commands. For each name operand, if it names an alias the alias is expanded. Otherwise the user's path is searched for a utility name matching name. Aliases are taken from the user's .cshrc file. path is taken from the current shell execution environment. OPERANDS
The following operand is supported: name The name of a command to be located. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 One or more name operands were not located or an error occurred. FILES
~/.cshrc source of aliases and path values ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), attributes(5) DIAGNOSTICS
A diagnostic is given for names which are aliased to more than a single word, or if an executable file with the argument name was not found in the path. NOTES
The which utility is not a shell built-in command. BUGS
To compensate for ~/.cshrc files in which aliases depend upon the prompt variable being set, which sets this variable to NULL. If the ~/.cshrc produces output or prompts for input when prompt is set, which can produce some strange results. SunOS 5.11 30 Mar 2005 which(1)
All times are GMT -4. The time now is 05:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy