Skip to content

Commit

Permalink
write example for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
bar-g authored Feb 28, 2024
1 parent e3b5422 commit 1035cc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/ysh-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.
Expand Down

0 comments on commit 1035cc4

Please sign in to comment.