-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
local keyword is not recognized in a function #220
Comments
Interestingly, it works correctly if the function is defined using the |
By the way, one more thing I'm seeing (ksh-20120801-31 version in Fedora 25): $ cat ./test.ksh
#!/bin/ksh
function func {
local stat=($(< /proc/self/stat))
echo $stat
}
func
exit 0 Results in: However, changing the script like this: #!/bin/ksh
function func {
stat=($(< /proc/self/stat))
echo $stat
unset stat
}
func
exit 0 Will work OK - for example:
The syntax error occurs only when code causing it is inside a function, and the variable is set to be |
Hmm, I'm also seeing no output when running just:
|
Note that this issue seems to be predicated on the |
IIRC The AST group subscribed strongly to the idea of one interface, one name, one behaviour. When introducing new behaviour they would go out of their way to create a new interface with a new name. From what I remember when |
@hlangeveld This is consistent with my understanding as well. |
I'll point out a few things about the
The first three would necessitate an implementation outside of |
I am in favour of having alias local=typeset |
Note that ast/src/cmd/ksh93/data/builtins.c Lines 69 to 72 in 856e095
What do people think about also making Note that the use of |
Note that due to how the builtin definitions interact with the |
Note: the |
Also, the |
I just noticed that /etc/profile on WSL (Windows Subsystem for Linux) assumes the shell supports the |
Sounds good to me. One thing to be aware of though is that in
Having a |
The AST team who implemented ast/src/cmd/ksh93/bltins/typeset.c Lines 409 to 414 in da398b6
Whether or not that test is 100% correct is TBD. |
I just noticed a bug in the existing code. Notice this definition: ast/src/cmd/ksh93/include/builtins.h Lines 43 to 47 in 014e908
That corresponds to an offset in ast/src/cmd/ksh93/data/builtins.c Lines 51 to 72 in 014e908
|
Rerpoducer script:
Running this script gives this error :
The text was updated successfully, but these errors were encountered: