From: Jakub Czajka Date: Sun, 29 May 2022 20:23:22 +0000 (+0200) Subject: [bash] Define dotfiles. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=e427eef37a644562ff20391647ddb90e292e209a;p=guix.git [bash] Define dotfiles. 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. --- diff --git a/README b/README index 17b9467..e30020b 100644 --- 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-specific dotfiles. diff --git a/bash/.bash_profile b/bash/.bash_profile new file mode 100644 index 0000000..d4a054e --- /dev/null +++ b/bash/.bash_profile @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright (c) 2022 Jakub Czajka +# 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 index 0000000..2a98ec7 --- /dev/null +++ b/bash/.bashrc @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright (c) 2022 Jakub Czajka +# 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"