rework bash scripts to be completely, or mostly POSIX-compliant

This commit is contained in:
2025-11-18 17:14:30 +01:00
parent cc07925346
commit a0b972d106
3 changed files with 20 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# shellcheck disable=1091
#
# ~/.bash_profile
@@ -13,7 +13,7 @@ export XDG_STATE_HOME="$HOME/var/lib" # state data that should persist between
export XDG_CACHE_HOME="$HOME/var/cache" # user-specific non-essential (cached) data.
export PATH="$XDG_BIN_HOME:$PATH" # add our bin in front of PATH, making it take precedence
if command -v nvim &>/dev/null; then
if command -v nvim >/dev/null; then
export EDITOR=nvim # use neovim as an editor
export VISUAL=nvim # use neovim for visual-based editors
export MANPAGER='nvim +Man!' # use neovim as a manual pager
@@ -22,14 +22,16 @@ fi
# coloured GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# export Microsoft's bullshit outta here
# Microsoft bullshit
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export VCPKG_DISABLE_METRICS=1
export VCPKG_ROOT="$XDG_DATA_HOME/vcpkg"
export PATH+=":$VCPKG_ROOT"
export PATH="$PATH:$VCPKG_ROOT"
# if executing interactively
# execute .bashrc in the current login context
[[ $- != *i* ]] && return
[[ -z ${PS1-} ]] && retrun
[[ -f $HOME/.bashrc ]] && . "$HOME/.bashrc"
case $- in
*i*) return ;;
esac
[ -z "${PS1-}" ] && return
[ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc"