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..
 
SHTOOL-PATH.TMP(1)					      GNU Portable Shell Tool						SHTOOL-PATH.TMP(1)

NAME
shtool-path - GNU shtool command dealing with shell path variables SYNOPSIS
shtool path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path path] str [str ...] DESCRIPTION
This command deals with shell $PATH variables. It can find a program through one or more filenames given by one or more str arguments. It prints the absolute filesystem path to the program displayed on "stdout" plus an exit code of 0 if it was really found. OPTIONS
The following command line options are available. -s, --suppress Supress output. Useful to only test whether a program exists with the help of the return code. -r, --reverse Transform a forward path to a subdirectory into a reverse path. -d, --dirname Output the directory name of str. -b, --basename Output the base name of str. -m, --magic Enable advanced magic search for ""perl"" and ""cpp"". -p, --path path Search in path. Default is to search in $PATH. EXAMPLE
# shell script awk=`shtool path -p "${PATH}:." gawk nawk awk` perl=`shtool path -m perl` cpp=`shtool path -m cpp` revpath=`shtool path -r path/to/subdir` HISTORY
The GNU shtool path command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1998 for Apache. It was later taken over into GNU shtool. SEE ALSO
shtool(1), which(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-PATH.TMP(1)
All times are GMT -4. The time now is 09:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy