home *** CD-ROM | disk | FTP | other *** search
- From: shipley@riki.berkeley.edu (Pete Shipley)
- Newsgroups: alt.sources
- Subject: Testpath: a path testing program.
- Message-ID: <1990Jun10.225128.10821@agate.berkeley.edu>
- Date: 10 Jun 90 22:51:28 GMT
-
-
- Testpath checks for the existance of each item in an user's path
- and reports bad entries.
-
- #! /bin/sh
- mkdir Testpath
- cd Testpath
- #! /bin/sh
- echo x - testpath
- cat >testpath <<'!E!O!F!'
- #! /bin/csh
-
- set spath=""
- set ppath=""
- unset vflag pflag
-
- top:
- if ($#argv > 0) then
- switch ($1)
-
- case -v:
- set vflag=1
- shift
- goto top
-
- case -p:
- set pflag=1
- shift
- goto top
-
- default:
- set spath="$spath $1"
- shift
- goto top
- endsw
- endif
-
- if ( "$spath" == "" ) then
- set spath="$path"
- endif
-
- foreach i ($spath)
-
- if ( ! -d $i ) then
- if (! $?pflag ) then
- echo "Bad path component:" $i
- endif
- else
- set ppath = "$ppath $i"
- if ( $?vflag ) then
- ls -lLdg $i
- endif
- endif
- end
-
- if ( $?pflag ) then
- echo $ppath
- endif
- !E!O!F!
- #! /bin/sh
- echo x - testpath.man
- cat >testpath.man <<'!E!O!F!'
- .TH testpath 1 local
- .SH NAME
- testpath - test users path for valid entries
- .SH SYNOPSIS
- testpath [-v] [-p] [path]
- .SH DESCRIPTION
- Testpath checks for the existance of each item in an user's path
- and reports bad entries.
- .SH OPTIONS
- .TP
- .B \-v
- list each path entry to inspect permissions.
- .TP
- .B \-p
- only print out valid path segments,
- bad entries in user's path are not reported.
- This is useful for checking a path before setting it.
- For example:
- .in +0.5i
- set path = `testpath -p /bin /usr/new /usr/bin /usr/ucb /usr/local/bin`
- .in -0.5i
- .LP
- If no path is given as an argument, testpath uses the path from
- the user's .cshrc.
- .SH FILES
- $HOME/.cshrc
- .SH SEE ALSO
- csh(1), ls(1)
- .SH DIAGNOSTICS
- Few, mostly from the shell.
- .SH AUTHOR
- Peter Shipley
- .SH BUGS
- written in csh.
- .\" END OF TEXT
- !E!O!F!
- cd ..
- Pete Shipley:
- email: shipley@berkeley.edu Flames: cimarron@postgres.berkeley.edu
- uunet!lurnix!shipley or ucbvax!shipley or pyramid!hippo!{ root peter }
- Spelling corections: /dev/null Quote: "Anger is an energy"
-