Create a gist now

Instantly share code, notes, and snippets.

@andydude /echo.rs
Last active Dec 17, 2015

What would you like to do?
POSIX echo
fn unwords(args: &[~str]) -> ~str {
return str::connect(args, " ");
}
fn echo(args: &[~str]) {
match args.tail() {
[~"-n", ..strs] => print(unwords(strs)),
strs => println(unwords(strs)),
}
}
fn main() {
echo(os::args());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment