1

I have a script file (it's .bashrc actually), in this file I have a lot of variables and functions which are used only inside this script, but these variables and functions are publicly visible for any bash session. To avoid collisions, make me (as a shell user) to understand that this variables are internal and avoid unnecessary autocompletion I added a prefix _bashrc_ for each variable and functions, e.g. _bashrc_extensions, but such prefixes looks ugly for me.

The idea I have in mind is to reduce scope of visibility to be able to remove these prefixes, but the only way I know in bash is to use local keyword, which can be used only inside a function. So I'm thinking about a function without a name which will be called immediately, something like this:

function {
  local path=$1
  # do something with $path
} "$HOME/.mypath"

Does something similar exist in bash?