The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-29-2008
fpeter75 fpeter75 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 2
check if specified path is in $PATH

echo $PATH | grep "\/usr\/ucb[:$]" is not working using sh-posix

The problem is very simle.
I want to check '/usr/ucb' is in the PATH environment variable.
If i simply grep '/usr/ucb' i might got wrong result eg '/usr/ucb/bin'.
After the path an end of line or colon character should be.

In other words: in range expression how can i use special character like $.

Thanks in advance
FPETER

Last edited by fpeter75; 08-29-2008 at 05:53 AM..