vrsh 0.1.2

A simple shell written for my own learning.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::env;
use std::path::Path;

pub fn is_valid_program_name(name: &str) -> bool {
    let executable = Path::new(name);
    if let Some(paths) = env::var_os("PATH") {
        for dir in env::split_paths(&paths).into_iter() {
            let full_path = dir.join(executable);
            if full_path.is_file() {
                return true;
            }
        }
    }

    return false;
}