I'm using Bash across most of my projects, so for me it's definitely here to stay :)
Truth be told, I haven't used readonly in any script, ever. I guess it's best practice to create immutable variables with:
declare -r VAR_NAME="CONSTANT_VALUE" VAR_NAME="trying-to-change-value" # Output # bash: VAR_NAME: readonly variable
Looks cool and easy to implement, I might adopt it in my future scripts.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm using Bash across most of my projects, so for me it's definitely here to stay :)
Truth be told, I haven't used readonly in any script, ever. I guess it's best practice to create immutable variables with:
Looks cool and easy to implement, I might adopt it in my future scripts.