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 that all arguments may be passed through command line.



Reply via email to