shell_default(3erl)

✨ shell_default ✨ β€” the Erlang module definition, but make it a vibe πŸŽ€

okay so bestie, this is a page from the stdlib docs, and honestly? it's giving "the shell's secret little helper module" energy. we're talking shell_default from Erlang, and it is literally about customizing your Erlang environment. let's get into it πŸ’…


🌸 NAME 🌸

shell_default β€” customizing the Erlang environment, periodt. that's the whole thing. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: the functions in this module get called when you don't specify a module name in a shell command. that's it, that's the magic. ✨

consider the following shell dialog, bestie β€” memorize this, it's iconic:

1> lists:reverse("abc").
"cba"
2> c(foo).
{ok, foo}

so in command one, module lists is called β€” you named it, so the shell goes straight there, no detours. but in command two, no module name is specified πŸ’€ and the shell does this whole little search thing: it looks in module user_default first, and then it searches module shell_default for function c/1. iykyk 🫢

now, the vibes of each module are very different and i need you to understand this:

  • shell_default is for "system wide" customizations to the shell β€” think big, think everyone, think main character energy for the whole system πŸ‘‘
  • user_default is for "local" or individual user customizations β€” that one's yours, it's personal, it's your little corner 🌸

πŸ’‘ HINT πŸ’‘

want to add your own commands to the shell? obsessed, let's go, here's the recipe πŸŽ€

create a module called user_default and add the commands you want in it. then add the following line as the first line in your .erlang file in your home directory:

code:load_abs("$PATH/user_default").

and $PATH? that's the directory where your user_default module can be found. don't forget it, bestie, or nothing loads and you'll be like 😭

fr fr: that line goes first in your .erlang file. first. no cap. πŸ™ˆ

okay that's the whole page and honestly it ate πŸ’… this was shell_default, from good old Ericsson AB, part of stdlib version 4.3.1.3, dated shell_default(3erl) β€” that's the source/version/date lineup, and no i'm not copying the footer line verbatim, i'm just giving it a cute little shoutout on the way out πŸ¦‹ mwah, go customize your shell, you got this πŸ’–βœ¨

πŸ“¦ where this page comes from