Function libmacchina::extra::which [−][src]
Expand description
Search all directories in PATH for a program e.g. ps, grep, etc.
This can be used to check if a particular program exists before running a command
that could return an error in case the program is not installed.
- Returns
true
if a given program is in PATH, andfalse
if it isn’t.
Example
use libmacchina::extra::which;
if which("grep") {
println!("grep is installed.");
} else {
println!("grep is not installed.");
}