This is an example function:
function example { echo "TextBefore $@ TextAfter" ; }
This is the command using the function:
example A{1..5}B
The output:
TextBefore A1B A2B A3B A4B A5B TextAfter
How I want it to be:
TextBefore A1B TextAfter
TextBefore A2B TextAfter
TextBefore A3B TextAfter
TextBefore A4B TextAfter
TextBefore A5B TextAfter
That's as good as I can describe it. If you understand it and know a better way of describing it, please edit the question.
How can I make each [insert word here] in the sequence being executed separately, as shown in that example?
function funcname {
is legacy ksh function declaration syntax -- a pre-POSIX convention that bash partially supports for backwards compatibility (without implementing the special behavior around locals that ksh associated with this syntax); for new code,example() { ...; }
should be strongly considered for use instead. See http://wiki.bash-hackers.org/scripting/obsolete – Charles Duffy Jun 16 '19 at 04:42