In Bash scripting, the eval command is often used to execute dynamically generated code. However, I have read that eval can be risky as it can lead to security vulnerabilities and make the code harder to maintain. Therefore, it's generally recommended to avoid using eval whenever possible.
Are there other alternative approaches I can use in bash scripting ?
This is what I am currently using
## start of file
shstate=$(shopt -p extglob)
shopt -s extglob
## sourcing a library here
eval "$shstate"
## end of file