Gopher Menu

       busybox ash "iSn’t vErY CuStOmIzAbLe"
       September 14th, 2022
       I use Alpine Linux, the default shell there is busybox ash, it's great.
       The only issues I see with it are the severe lack of documentation (the
(HTML) best way to figure things out are to read the source or just see if
       whatever feature it is you are trying to use {likely from bash} actually
       works) and lack of the command completion from bash (which I don't use).
(HTML) Recently while browsing reddit, a user on the Alpine Linux sub was
       asking if it is possible to make ash look a little prettier (it is), and
       the replies were either encouraging the OP to try another shell, or the
       hilarious repies of:
       "ash isn’t meant to be customizable. Look at the man page for options."
       "Ash still isn’t very customizable."
       "Ash still isn’t very customizable."
 (IMG) suspected image of spicyboi404
       My head really hurts, the stupid is just intolerable.
       Since busybox ash is (as mentioned) severely lacking in documentation
       I thought I'd post a few things that I know about customizing it off the
       top of my head, these are specific to the Alpine Linux version of it, as
       most others are going to have a vastly different build configuration:
       busybox ash expand prompt strings:
       \a     bell character (07), typically sounds the terminal bell/buzzer
       \e     escape character (33), used for terminal functions such as ANSI
              colors, bold, italics, underline, et al
       \h     short hostname
       \H     long hostname (FQDN), if known, otherwise same as \h
       \n     linefeed (newline)
       \r     carriage return (needed for some unusual terminals (\r\n)
       \t     current time in HH:MM format
       \T     same as \t
       \@     same as \t
       \A     same as \t
       \u     user who is running the shell
       \w     Current working directory, $HOME abbreviated to ~
       \W     basename of current working directory, $HOME abbreviated to ~
       \nnn   replace `nnn' with the octal number of a character you wish to
              print for example `\007' is the same as `\a'
       \[     Start a sequence of non-printable characters. Used for terminal
              control stuff mostly;
       \]     End a sequence of non-printable characters
       busybox ash environmental variables
       $PS1           main prompt string
       $PS2           continuation prompt string
       $PS4           prefix for xtrace shell option output
       $TMOUT         Enable bash-like auto-logout after $TMOUT seconds of
                      idle time.
       $MAIL          Mail file, ash will print "you have mail" if the file
       $MAILPATH      Mail directory, ash will print "you have mail" if
                      changes are seen.
       $RANDOM        Each read of "$RANDOM" will generate a new pseudorandom
                      value. You can reset the generator by using a specified
                      start value. After "unset RANDOM" the generator will
                      switch off and this variable will no longer have special
       $LANG          language, also used for unicode stuff (C.UTF-8 anyone?)
       $LC_ALL        language, also used for unicode stuff
       $LC_CTYPE      language, also used for unicode stuff
       shell options, use the set command to set these. (e.g. `set -o noglob')
       "e"   "errexit"        Exit immediately upon error (useful for scripts)
       "f"   "noglob"         Disable filename globbing (cat *.html will no
                              longer work)
       "I"   "ignoreeof"      Disables exiting on EOF (CTRL+D no longer exits)
       "i"   "interactive"    Marks the shell as human interactive
       "m"   "monitor"        Enables job control (on by default for
                              interactive shells)
       "n"   "noexec"         Doesn't execute commands, but still parses input
                              very useful for shell scripting or pranks.
       "x"   "xtrace"         before executing a command, print the actual
                              command that will be executed. Useful for
                              dealing with aliases & functions
       "v"   "verbose"        prints shell input
       "C"   "noclobber"      Output redirection (>) will only be allowed to
                              write new files, existing files will not be
       "a"   "allexport"      Variables and functions which are set while this
                              option is in effect will be exported to
                              subshells etc.
       "u"   "nounset"        Attempts to use unset variables and parameters
                              will print an error. Non-interactive shells will
                              exit also. Useful for scripting.
             "vi"             use vi-style line editing interface.
             "pipefail"       Cloned from bash: "If set, the return value of
                              a pipeline is the value of the last (rightmost)
                              command to exit with a non-zero status, or zero
                              if all commands in the pipeline exit
                              successfully. Disabled by default."
       make ash look a little prettier:
       \033[30;37;5m😊\e[0m\w "
       Did I miss anything? Do you have a prettier prompt for busybox ash?
       Let us know in the comments below. (or on the reddit thread, why not?)
 (DIR) Back to phlog index
 (DIR) gopher root
       385 folks think that spicyboi404 is a dumbass.
  (?)  Comments are enabled for this post, select here to leave yours
       Nobody has commented on this post.