My .bashrc had some code that was repetitive so I used a function to simplify it
do_stuff() {
local version=$1
export FOO_${version}_X="17"
export FOO_${version}_Y="42"
}
do_stuff '5.1'
do_stuff '5.2'
However, now when I use my shell the "do_stuff" name is in scope so I can tab-complete and run that function (potentially messing up my environment variables). Is there a way to make "do_stuff" visible only inside the .bashrc?
()
to make a subshell. Another possibility for simple cases is using afor version in 5.1 5.2
loop, although this letsversion
escape.