Skip to content

Use 'echo -e' to evaluate ascii codes in message. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bacek
Copy link

@bacek bacek commented Mar 26, 2018

Without -e echo will output unicode as-is. E.g.:

fmt \xE2\x9C\x93
test \xE2\x9C\x93

With -e it's actually evaluating them into
fmt ✓
test ✓

@@ -99,13 +98,13 @@ fn format_test((k, v): (&String, &toml::Value)) -> String {
format!(r#"printf "{}"

if result=$({}); then
echo " $check"
echo -e " $check"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use printf instead of echo -e?

Copy link
Author

@bacek bacek Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bash-fu isn't strong enough. I couldn't figure out how to emulate '''echo " $result"' with printf. Using %s print all lines left-aligned.

format ✖ Diff
 in .../main.rs
 at line
 280: let
 sigterm =
 unix::Signal::new(unix::libc::SIGTERM, &handle).flatten_stream();⏎
 let sigint
 = unix::Signal::new(unix::libc::SIGINT,
 &handle).flatten_stream();⏎ ⏎
 - let
 stream =
 sigint.select(sigterm).take(1).for_each(|s| {⏎
 + let
 stream =
 sigint.select(sigterm).take(1).for_each(|s| {⏎
 info!(root_logger, "Got
 signal {:?}",
 s);⏎ ⏎
 Ok(())⏎ 

vs

format ✖ Diff in .../main.rs at line 280:
     let sigterm = unix::Signal::new(unix::libc::SIGTERM, &handle).flatten_stream();⏎
     let sigint = unix::Signal::new(unix::libc::SIGINT, &handle).flatten_stream();⏎
 ⏎
-        let stream = sigint.select(sigterm).take(1).for_each(|s| {⏎
+    let stream = sigint.select(sigterm).take(1).for_each(|s| {⏎
         info!(root_logger, "Got signal {:?}", s);⏎
 ⏎
         Ok(())⏎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants