On 17/03/2024 23:56, Greg Wooledge wrote:
On Sun, Mar 17, 2024 at 11:14:56PM +0700, Max Nikulin wrote:
args() { printf '%s\0' a b c d; }
args | xargs -0 sh -c 'count() { echo $#; }; count "$@"' sh-count
It would be easier in the case of script file instead of shell function. An
assumption is t
On Sun, 17 Mar 2024, Greg Wooledge wrote:
Tim's assumption here is that he can write a function which emits a
stream of whitespace-separated words, and use this safely in an unquoted
command substitution.
count $(args)
I'm guessing "count" is a stand-in for something more complex, but $(arg
On Sun, 17 Mar 2024, Greg Wooledge wrote:
On Sun, Mar 17, 2024 at 09:25:10AM +, Tim Woodall wrote:
In almost all other cases, the space separated items cannot, even in
theory, contain a rogue space, so suppressing the warning is fine
Famous Last Words™.
As one example, it calls out to a
On Sun, Mar 17, 2024 at 10:57:43AM -0500, Nate Bargmann wrote:
> What errors do you get if you use sh instead of bash?
He's not getting any errors. His script actually works for his current
inputs. He was just getting warnings from shellcheck, which is an
external script validation tool.
One of
On 17/03/2024 16:25, Tim Woodall wrote:
args() { echo a b c d; }
count() { echo $#; }
count $(args)
args() { printf '%s\0' a b c d; }
args | xargs -0 sh -c 'count() { echo $#; }; count "$@"' sh-count
It would be easier in the case of script file instead of shell function.
An assumption is tha
Hi Tim.
What errors do you get if you use sh instead of bash? On Debian systems
sh should be a symbolic link to dash. On Debian dash is preferred for
system shell scripts (perhaps even required now) and I use it for my
personal scripts unless there is some need to use bash instead. I still
use
On Sun, Mar 17, 2024 at 09:25:10AM +, Tim Woodall wrote:
> I have this one-liner (which works but shellcheck doesn't like the
> quoting)
>
> idxsrc="$( newest_file $( APT_CONFIG=${APT_CONFIG} apt-get indextargets
> --format '$(FILENAME)' 'Identifier: Packages' ))"
>
> SC2016: Expressions don
On Sun, 17 Mar 2024, Geert Stappers wrote:
On Sun, Mar 17, 2024 at 09:25:10AM +, Tim Woodall wrote:
Hi,
I've been cleaning up some bash scripts
Good
and, where possible, addressing things reported by shellcheck.
Oh, shellcheck, https://www.shellcheck.net/
I have this one-liner (
On Sun, Mar 17, 2024 at 09:25:10AM +, Tim Woodall wrote:
> Hi,
>
> I've been cleaning up some bash scripts
Good
> and, where possible, addressing things reported by shellcheck.
Oh, shellcheck, https://www.shellcheck.net/
> I have this one-liner (which works but shellcheck doesn't like
On Sun, Mar 17, 2024 at 09:25:10AM +, Tim Woodall wrote:
> Hi,
[...]
> Is there a one-liner way to make shellcheck happy on the count line
> below (other than # shellcheck disable=SC2046)?
>
> args() { echo a b c d; }
> count() { echo $#; }
> count $(args)
>
> Obviously, any correct solutio
10 matches
Mail list logo