Difference between local -a args=( ) and local args=( )
Clash 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.
bash shell-script
add a comment |Â
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.
bash shell-script
add a comment |Â
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.
bash shell-script
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.
bash shell-script
asked Nov 5 '17 at 19:21
Alexander Mills
1,9441029
1,9441029
add a comment |Â
add a comment |Â
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 ()
.
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 thislocal -a args=()
is different thanlocal -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 betweenlocal -a args=()
andlocal -a args=( )
â fpmurphy1
Nov 6 '17 at 0:50
add a comment |Â
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 ()
.
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 thislocal -a args=()
is different thanlocal -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 betweenlocal -a args=()
andlocal -a args=( )
â fpmurphy1
Nov 6 '17 at 0:50
add a comment |Â
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 ()
.
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 thislocal -a args=()
is different thanlocal -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 betweenlocal -a args=()
andlocal -a args=( )
â fpmurphy1
Nov 6 '17 at 0:50
add a comment |Â
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 ()
.
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 ()
.
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 thislocal -a args=()
is different thanlocal -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 betweenlocal -a args=()
andlocal -a args=( )
â fpmurphy1
Nov 6 '17 at 0:50
add a comment |Â
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 thislocal -a args=()
is different thanlocal -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 betweenlocal -a args=()
andlocal -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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password