Skip to content

Instantly share code, notes, and snippets.

@blurbdust
Created February 2, 2019 16:06
Show Gist options
  • Save blurbdust/c8369b48943bb7df8927c6787c852909 to your computer and use it in GitHub Desktop.
Save blurbdust/c8369b48943bb7df8927c6787c852909 to your computer and use it in GitHub Desktop.
use std::env;
fn main() -> std::io::Result<()>{
let together = "Good morning ".to_owned();
print!("{}", together);
match env::var("USER") {
Ok(val) => print!("{}", val),
Err(e) => print!("err: {}", e),
}
let t = " on ".to_owned();
print!("{}", t);
match env::var("HOSTNAME") {
Ok(val) => print!("{}", val),
Err(e) => print!("err: {}", e),
}
let tt = ". The current directory is ".to_owned();
print!("{}", tt);
let path = env::current_dir()?;
print!("{}.", path.display());
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment