snix Shell configuration files for Linux systems
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
sam ef13f494ae ps1: read the shell name from $0 before /proc
A chroot without its own /proc still has the host's mounted, so
/proc/$$/comm resolved the chroot-local PID against host processes and
returned whatever ran under that number — an Alpine chroot showed
|init|.

$0 is the shell naming itself and needs no /proc at all; when sourced,
as this file always is, it holds the shell rather than a script name.
Keep /proc as the fallback for when $0 is not a shell name.
2026-09-05 09:24:32 +02:00
build build: pick the highest version tag, not the newest one 2026-09-02 15:57:08 +02:00
etc ps1: read the shell name from $0 before /proc 2026-09-05 09:24:32 +02:00
LICENSE Aggiungi LICENSE 2026-03-24 05:49:19 +00:00
README.md ps1: unify prompt into one file with composable segments 2026-08-28 15:41:33 +02:00

shell

Shell configuration files for Linux systems.

Structure

etc/
  profile.d/
    bash_colors   # ANSI color variables for bash prompts
    alias         # common aliases: c, e, l, ll
    ps1           # PS1_BASH and PS1_ZSH, composed from conditional segments
    init          # entry point for sh/ash
    shell         # sets PS1, runs fastfetch if available
  bash/
    local         # entry point for bash  →  /etc/bash/local
  shell_init      # container init: asks hostname once, writes ps1.conf

Generated at runtime, not shipped by the package:

/etc/ps1.conf   # PS1_HOST / PS1_SYSTEM, written by shell_init

Prompt segments

ps1 builds both prompts by accumulation — each segment is one line carrying its bash and zsh form side by side, prepended only when it applies:

PS1_HOST         if ps1.conf has one     srv1::
container        if $container is set     incus<priv>:
chroot           if in a chroot           (chroot)
user@host, cwd, shell label               always

chroot is detected from field 4 of /proc/self/mountinfo (the mount's root within its filesystem: / outside, the subdirectory path inside). A bare chroot(1) without a mount namespace is not detectable this way — declare it explicitly with /etc/debian_chroot, whose contents override the label.

Installed at runtime if the shell is present:

zsh:
  /etc/zsh/zshrc.d/pre   # adds zcompletion to fpath
  /etc/zsh/zshrc.d/end   # entry point for zsh

fish:
  /etc/fish/conf.d/alias.fish   # symlink to /etc/profile.d/alias
  /etc/fish/conf.d/config.fish  # disables history, runs fastfetch

Loading flow

ash/sh  →  profile.d/init  →  alias + shell_init + shell + ps1 + bash_colors
bash    →  bash/local      →  init (above), then sets PS1=$PS1_BASH
zsh     →  zsh/zshrc.d/pre →  zcompletion fpath
        →  zsh/zshrc.d/end →  init (above), then sets PS1=$PS1_ZSH
fish    →  fish/conf.d/alias.fish + config.fish

The shell label in the prompt is detected at runtime ($ZSH_VERSION, $BASH_VERSION, then /proc/$$/comm), so no file rewrites the prompt after the fact.