Skip to content
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

fix array declaration for install_site #60

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

chaen
Copy link
Contributor

@chaen chaen commented Feb 29, 2024

When running bash with -u, an array declared with declare -a is considered as unbound variable if you do not put anything in it. It is not if you declare the array with ()
Noticed while installing new EL9 machine.
I don't know why it was not spotted before

[dirac@lbvobox900 ~]$ set +u
[dirac@lbvobox900 ~]$ declare -a with_declare
[dirac@lbvobox900 ~]$ echo "${with_declare[@]}"

[dirac@lbvobox900 ~]$ echo "${#with_declare[@]}"
0
[dirac@lbvobox900 ~]$ with_parent=()
[dirac@lbvobox900 ~]$ echo "${with_parent[@]}"

[dirac@lbvobox900 ~]$ echo "${#with_parent[@]}"
0




[dirac@lbvobox900 ~]$ set -u
[dirac@lbvobox900 ~]$ declare -a with_declare
[dirac@lbvobox900 ~]$ echo "${with_declare[@]}"

[dirac@lbvobox900 ~]$ echo "${#with_declare[@]}"
-bash: with_declare: unbound variable
[dirac@lbvobox900 ~]$ with_parent=()
[dirac@lbvobox900 ~]$ echo "${with_parent[@]}"

[dirac@lbvobox900 ~]$ echo "${#with_parent[@]}"
0

@fstagni fstagni merged commit 59f86de into DIRACGrid:master Feb 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants