Difference between local -a args=( ) and local args=( )

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Is there a differece between:



local args=("$@")


and



local -a args=("$@")


I see some code with the -a argument, but cannot figure out what it's there for.







share|improve this question
























    up vote
    0
    down vote

    favorite












    Is there a differece between:



    local args=("$@")


    and



    local -a args=("$@")


    I see some code with the -a argument, but cannot figure out what it's there for.







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Is there a differece between:



      local args=("$@")


      and



      local -a args=("$@")


      I see some code with the -a argument, but cannot figure out what it's there for.







      share|improve this question












      Is there a differece between:



      local args=("$@")


      and



      local -a args=("$@")


      I see some code with the -a argument, but cannot figure out what it's there for.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 '17 at 19:21









      Alexander Mills

      1,9441029




      1,9441029




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          No. Assigning an array directly already forces it to be an array. You would only need to use -a if you were not assigning and wanted the variable to start with ().






          share|improve this answer




















          • right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
            – Alexander Mills
            Nov 5 '17 at 19:37










          • $ foo=( ) $ echo $#foo[@] 0 No difference.
            – Ignacio Vazquez-Abrams
            Nov 5 '17 at 19:38










          • No, there is no difference between local -a args=() and local -a args=( )
            – fpmurphy1
            Nov 6 '17 at 0:50











          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f402710%2fdifference-between-local-a-args-and-local-args%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          No. Assigning an array directly already forces it to be an array. You would only need to use -a if you were not assigning and wanted the variable to start with ().






          share|improve this answer




















          • right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
            – Alexander Mills
            Nov 5 '17 at 19:37










          • $ foo=( ) $ echo $#foo[@] 0 No difference.
            – Ignacio Vazquez-Abrams
            Nov 5 '17 at 19:38










          • No, there is no difference between local -a args=() and local -a args=( )
            – fpmurphy1
            Nov 6 '17 at 0:50















          up vote
          2
          down vote



          accepted










          No. Assigning an array directly already forces it to be an array. You would only need to use -a if you were not assigning and wanted the variable to start with ().






          share|improve this answer




















          • right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
            – Alexander Mills
            Nov 5 '17 at 19:37










          • $ foo=( ) $ echo $#foo[@] 0 No difference.
            – Ignacio Vazquez-Abrams
            Nov 5 '17 at 19:38










          • No, there is no difference between local -a args=() and local -a args=( )
            – fpmurphy1
            Nov 6 '17 at 0:50













          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          No. Assigning an array directly already forces it to be an array. You would only need to use -a if you were not assigning and wanted the variable to start with ().






          share|improve this answer












          No. Assigning an array directly already forces it to be an array. You would only need to use -a if you were not assigning and wanted the variable to start with ().







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 5 '17 at 19:34









          Ignacio Vazquez-Abrams

          32.1k66780




          32.1k66780











          • right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
            – Alexander Mills
            Nov 5 '17 at 19:37










          • $ foo=( ) $ echo $#foo[@] 0 No difference.
            – Ignacio Vazquez-Abrams
            Nov 5 '17 at 19:38










          • No, there is no difference between local -a args=() and local -a args=( )
            – fpmurphy1
            Nov 6 '17 at 0:50

















          • right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
            – Alexander Mills
            Nov 5 '17 at 19:37










          • $ foo=( ) $ echo $#foo[@] 0 No difference.
            – Ignacio Vazquez-Abrams
            Nov 5 '17 at 19:38










          • No, there is no difference between local -a args=() and local -a args=( )
            – fpmurphy1
            Nov 6 '17 at 0:50
















          right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
          – Alexander Mills
          Nov 5 '17 at 19:37




          right, yeah, the title of the question is different than the body for a reason... you have answered my question though, do you know if this local -a args=() is different than local -a args=( ) (the extra space between the parens)
          – Alexander Mills
          Nov 5 '17 at 19:37












          $ foo=( ) $ echo $#foo[@] 0 No difference.
          – Ignacio Vazquez-Abrams
          Nov 5 '17 at 19:38




          $ foo=( ) $ echo $#foo[@] 0 No difference.
          – Ignacio Vazquez-Abrams
          Nov 5 '17 at 19:38












          No, there is no difference between local -a args=() and local -a args=( )
          – fpmurphy1
          Nov 6 '17 at 0:50





          No, there is no difference between local -a args=() and local -a args=( )
          – fpmurphy1
          Nov 6 '17 at 0:50


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402710%2fdifference-between-local-a-args-and-local-args%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay