emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ob-shell-test, test-ob-shell and introduction


From: Max Nikulin
Subject: Re: [PATCH] ob-shell-test, test-ob-shell and introduction
Date: Fri, 7 Jan 2022 23:18:24 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 06/01/2022 10:47, Matt wrote:

  > - In your examples variable values are simple. Often it is safer to add
  > double quotes around variable or command expansion. I would consider
  > adding quotes just to encourage people to do the same by default with

I appreciate these clarifications. Admittedly, I'm not great with
shell scripting.  Your recommendations appear sound to me and I've tried
to incorporate them.

I think, to illustrate unset variable escaped quotes were appropriate. Sorry that I was not clear enough.

   echo "X was set to \"$X\""

One more case where it is better (at least from my point of view) to add quotes even though they are not strictly necessary since command output contains single word and multiple words are interpreted by echo in the same way:

   echo "$(cut -f 1 -d "/") rocks!"

The updates have been made and are pushed. Thanks for your feedback!

Thank you, text is more clear now. However first time I read it with more attention.

I forgot to suggest you the following tool that catches more problems than execution the script with "-n" option:

echo 'a=2; echo "$(($a * 2))"' | shellcheck -s sh -

In - line 1:
a=2; echo "$(($a * 2))"
              ^-- SC2004: $/${} is unnecessary on arithmetic variables.

For more information:
https://www.shellcheck.net/wiki/SC2004 -- $/${} is unnecessary on arithmeti...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]