Chris Lamb <la...@debian.org> writes:

> Note that the unquoted version on line 3 is not warned about. Not sure
> if this is due to the subshell or the implicit nested quotes..

To distinguish, I've made another test case. Attached to this message
#! /bin/sh

printf "%s %s\n" "command-not-quoted" "list-not-quoted"
. $(printf "lorem %s\n" foo bar baz)

printf "%s %s\n" "command-not-quoted" "list-quoted"
. $(printf "lorem %s\n" "foo bar baz")

printf "%s %s\n" "command-quoted" "list-not-quoted"
. "$(printf "lorem %s\n" foo bar baz)"

printf "%s %s\n" "command-quoted" "list-quoted"
. "$(printf "lorem %s\n" "foo bar baz")"
That causes two warnings from ‘checkbashisms’:

=====
$ checkbashisms ./870309.test.sh
possible bashism in ./870309.test.sh line 10 (sourced script with arguments):
. "$(printf "lorem %s\n" foo bar baz)"
possible bashism in ./870309.test.sh line 13 (sourced script with arguments):
. "$(printf "lorem %s\n" "foo bar baz")"
=====

So, it complains when the argument to ‘.’ is a quoted command
substitution, but not when it's an unquoted command substitution.

-- 
 \      “I busted a mirror and got seven years bad luck, but my lawyer |
  `\                        thinks he can get me five.” —Steven Wright |
_o__)                                                                  |
Ben Finney <bign...@debian.org>

Reply via email to