From 1035cc4536492961de3a50a42737f7727cabb496 Mon Sep 17 00:00:00 2001 From: bar-g <105970722+bar-g@users.noreply.github.com> Date: Wed, 28 Feb 2024 19:32:58 +0000 Subject: [PATCH] write example for comparison --- doc/ysh-faq.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ysh-faq.md b/doc/ysh-faq.md index 9d53e4d7c6..281a9f87cc 100644 --- a/doc/ysh-faq.md +++ b/doc/ysh-faq.md @@ -107,7 +107,7 @@ That is, `echo "$flag"` always has a few bugs: when `$flag` is `-e`, `-n`, So portable shell scripts use: - printf '%s\n' "$x" # print $x "unmolested" in POSIX shell + printf '%s\n' "$x" # print "unmolested" in POSIX shell We could have chosen to respect `echo -- $x`, but as YSH already has: @@ -117,6 +117,7 @@ It allowed YSH to have: echo $x # YES: an even shorter way write --sep ' ' -- $x # synonym + write -- $x $y # alternative (one line per arg) So `echo` is technically superfluous in YSH, but it's also short, familiar, and correct.