Skip to main content
6 events
when toggle format what by license comment
Nov 20, 2023 at 2:47 comment added Eric Renouf @SergeyPonomarev Sure, but those are not bash, and this question specifically asks about bash. Using eval will always be risky if processing user supplied values, but perhaps there are situations where that will be a suitable approach
Nov 18, 2023 at 14:29 comment added Sergey Ponomarev The ${!var_name} doesn't work in BusyBox ash and dash so the eval var_val=\$$var_name is the only cross platform syntax :(
Jan 30, 2021 at 6:49 comment added Gabriel Staples Great answer! Upvoted. I expounded upon your answer with additional insight and explanation, and added an "equivalent" example using the "evil" eval, in my answer I just added here: unix.stackexchange.com/questions/222487/….
Aug 27, 2020 at 10:19 comment added Binarus Thank you very much, and +1. This should be the accepted answer, since it does not use eval and since the OP specifically has asked for bash, so portability is not an issue. However, to read more details about it in the bash manual and to be able to find the respective section, how is this construct / method called?
Aug 6, 2018 at 22:01 comment added gavenkoa There is portable way with eval var=\$$holder but eval is dangerous!
Aug 11, 2015 at 19:08 history answered Eric Renouf CC BY-SA 3.0