Bash function: Execute $@ command with each argument in sequence executed separatelyPrecedence of the shell...

Fill the maze with a wall-following Snake until it gets stuck

First occurrence in the Sixers sequence

Why should the equality of mixed partials be "intuitively obvious"?

Why are almost all the people in this orchestra recording wearing headphones with one ear on and one ear off?

1960s sci-fi anthology with a Viking fighting a U.S. army MP on the cover

Print the phrase "And she said, 'But that's his.'" using only the alphabet

Can "Es tut mir leid" be used to express empathy rather than remorse?

Right indicator flash-frequency has increased and rear-right bulb is out

Lead the way to this Literary Knight to its final “DESTINATION”

Redirecting output only on a successful command call

How do I gain the trust of other PCs?

Co-worker is now managing my team. Does this mean that I'm being demoted?

How do credit card companies know what type of business I'm paying for?

Leveraging cash for buying car

How did Avada Kedavra get its name?

Is swap gate equivalent to just exchanging the wire of the two qubits?

At what temperature should the earth be cooked to prevent human infection?

How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?

My husband's visa refused but mine wasn't -- can I travel?

Have Steve Rogers (Captain America) and a young Erik Lehnsherr (Magneto) interacted during WWII?

Why can't we feel the Earth's revolution?

How can Caller ID be faked?

What do I put on my resume to make the company i'm applying to think i'm mature enough to handle a job?

How can I ping multiple IP addresses at the same time?



Bash function: Execute $@ command with each argument in sequence executed separately


Precedence of the shell logical operators &&, ||How can I see the exact command line being executed inside some bash instance?bash - wrong key sequence bindings with control+alt+spaceBash: redirect command argument completionUsing bind to read the current command lineShould I routinely put double quotes around my echo statements?Command that works fine typed into terminal does not work as a bash functionHow exactly does the typical shell “fork bomb” call itself twice?bash echo the command line executed at the command line itself (not in a script)Shell Function: Sequence of Pipelines as Argument






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















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?










share|improve this question





























    0















    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?










    share|improve this question

























      0












      0








      0








      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?










      share|improve this question














      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?







      bash terminal seq






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 23 mins ago









      neverMind9neverMind9

      693321




      693321






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Try this:



          function example { printf 'TextBefore %s TextAftern' "$@"; }





          share|improve this answer
























          • It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

            – neverMind9
            17 mins ago














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f525055%2fbash-function-execute-command-with-each-argument-in-sequence-executed-separa%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Try this:



          function example { printf 'TextBefore %s TextAftern' "$@"; }





          share|improve this answer
























          • It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

            – neverMind9
            17 mins ago


















          2














          Try this:



          function example { printf 'TextBefore %s TextAftern' "$@"; }





          share|improve this answer
























          • It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

            – neverMind9
            17 mins ago
















          2












          2








          2







          Try this:



          function example { printf 'TextBefore %s TextAftern' "$@"; }





          share|improve this answer













          Try this:



          function example { printf 'TextBefore %s TextAftern' "$@"; }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 19 mins ago









          FreddyFreddy

          4,8631521




          4,8631521













          • It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

            – neverMind9
            17 mins ago





















          • It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

            – neverMind9
            17 mins ago



















          It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

          – neverMind9
          17 mins ago







          It works! Thanks alot! (StackExchange says: “You can accept an answer in 10 minutes”.)

          – neverMind9
          17 mins ago




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f525055%2fbash-function-execute-command-with-each-argument-in-sequence-executed-separa%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...