]> git.ekhem.eu.org Git - guix.git/commitdiff
[bash] Define dotfiles.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 29 May 2022 20:23:22 +0000 (22:23 +0200)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
Shells are command line interpreter for UNIX systems. These shells can
operate in one of three modes: interactive, non-interactive or
login. Login mode starts with a login prompt. After that it works
similarly to either interactive or non-interactive mode.

~/.bash_profile is the dotfile for bash in the login mode. It sources
program-specific *.sh profiles in {XDG_CONFIG_HOME}/profile.d. This
mimics behaviour of /etc/profile, the global shell dotfile.

~/,bashrc is the dotfile for bash in the interactive mode.

README
bash/.bash_profile [new file with mode: 0644]
bash/.bashrc [new file with mode: 0644]

diff --git a/README b/README
index 17b94674d5acb58b956bda8fd69910bdec0deeaa..e30020bdd591656a43aa2428a926cca910966ed5 100644 (file)
--- a/README
+++ b/README
@@ -1,9 +1,11 @@
 guix
 ====
 
-System and home directory configuration for the GNU Guix operating system.
+System and home directory configuration for the GNU Guix operating system. It
+installs programs and their configuration files (dotfiles).
 
 Files
 -----
 
-* home.scm - home directory configuration for the GNU Guix operating system.
+* home.scm   - home directory configuration for the GNU Guix operating system.
+* <program>/ - program-specific dotfiles.
diff --git a/bash/.bash_profile b/bash/.bash_profile
new file mode 100644 (file)
index 0000000..d4a054e
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# .bash_profile - bash dotfile for login shells.
+#
+# Sources program-specific profiles from $XDG_CONFIG_HOME/profile.d and starts
+# Xorg. See bash(1) for more information about login shells.
+
+_confdir=${XDG_CONFIG_HOME:-${HOME}/.config}
+
+if [ -d ${_confdir}/profile.d/ ]; then
+    for _f in ${_confdir}/profile.d/*.sh; do
+       [ -r ${_f} ] && . ${_f}
+    done
+    unset _f
+fi
+
+unset _confdir
diff --git a/bash/.bashrc b/bash/.bashrc
new file mode 100644 (file)
index 0000000..2a98ec7
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# .bashrc - bash dotfile for interactive shells.
+#
+# Sources $HOME/.bash_profile. See bash(1) for more information about interactive
+# shells.
+
+if [ -f "${HOME}/.bash_profile" ]; then
+    . ${HOME}/.bash_profile
+fi
+
+# Prompt
+export PS1="[\w]$ "
+
+# Aliases
+alias ls="ls --color=auto"