shell_default(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– shell_default β€” it's giving Erlang Module Definition πŸ¦‹

ok so this is the shell_default page from the Erlang docs, manual section 3, and it's literally all about making your Erlang shell feel like your shell. bestie, let's get into it ✨


🌸 NAME 🌸

shell_default β€” customizing the Erlang environment, no cap πŸ’…


✨ 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 whole vibe.

lowkey the clearest way to get it is with an example, so picture this shell dialog:

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

so in command one, module lists is called β€” you named it, everyone knows who's on aux πŸŽ€. in command two, no module name is specified at all. and here's the part that matters: the shell searches module user_default first, and then module shell_default, looking for function c/1 πŸ‘‘

and like, why do both exist?? bc they serve two totally different purposes, iykyk:

  • shell_default is for "system wide" customizations to the shell πŸ‘‘
  • user_default is for "local" or individual user customizations 🫢

🧚 Hint 🧚

want your own commands in the shell?? obsessed, do it bestie πŸ’– here's the recipe:

  1. create a module called user_default
  2. add the commands you want to it
  3. 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 (yes, in the code, exactly like that) is the directory where your user_default module can be found 🌈


⭐ FUNCTIONS ⭐

  • help() -> true. β€” prints the help for all the shell commands. every single one. main character behavior fr fr πŸ’…

ok that's the whole page, short and sweet, we love a compact manpage ✨

sign-off time πŸŽ€πŸ¦‹: this gorgeous little page comes to you from Ericsson AB, rocking version stdlib 8.0.4 β€” and it's filed under shell_default(3), so you can always find your way back, bestie πŸ’œ

πŸ“¦ where this page comes from