fn chdir(args : SplitWhitespace){
    let dir = args.peekable().peek().map_or("/",|x|*x);
    let root = Path::new(&(dir));

    if !root.is_dir() {
        println!("{}: No such directory", dir);
    }
    else{
        if let Err(e) = env::set_current_dir(&root) {
            eprintln!("{}", e);
        }
    }
}
/***********************************************************
 * Function: Implement the function of changing directory(CD) command
 * Description: execute cd[directory]
 * ***********************************************************/
Implement the function of changing directory(CD) command
Description: execute cd[directory]
Implement the function of changing directory ( CD ) command Description : execute cd [ directory ]
fn chdir(args : SplitWhitespace){
    let dir = args.peekable().peek().map_or("/",|x|*x);
    let root = Path::new(&(dir));
    if !root.is_dir() {
        println!("{}: No such directory", dir);
    }
    else{
        if let Err(e) = env::set_current_dir(&root) {
            eprintln!("{}", e);
        }
    }
}
fn chdir ( args : SplitWhitespace ) { let dir = args . peekable ( ) . peek ( ) . map_or ( " " , | x | * x ) ; let root = Path :: new ( & ( dir ) ) ; if ! root . is_dir ( ) { println ! ( " " dir ) ; } else { if let Err ( e ) = env :: set_current_dir ( & root ) { eprintln ! ( " " e ) ; } } }
Function: Implement the function of changing directory(CD) command
 Description: execute cd[directory]
Function : Implement the function of changing directory ( CD ) command Description : execute cd [ directory ]
args
SplitWhitespace