aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-22 07:35:53 +0000
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-22 07:35:55 +0000
commit01707c746f1b0ade415d033fdef679c227e01b7a (patch)
tree18652cf41968a43a4e66e8165f960cd171f7706a /%HOME%/.bash_utils
parent.profile: add the normal sed to PATH on macOS (diff)
downloadlinux-home-01707c746f1b0ade415d033fdef679c227e01b7a.tar.gz
linux-home-01707c746f1b0ade415d033fdef679c227e01b7a.zip
ignore unsupported inherit_errexit
I have a really ancient machine with an even more ancient version of bash that doesn't support inherit_errexit. Ignore for now, put it back later.
Diffstat (limited to '')
-rw-r--r--%HOME%/.bash_utils/alternatives.sh8
-rw-r--r--%HOME%/.bash_utils/cxx.sh7
-rw-r--r--%HOME%/.bash_utils/distr.sh18
-rw-r--r--%HOME%/.bash_utils/file.sh4
-rw-r--r--%HOME%/.bash_utils/git.sh19
-rw-r--r--%HOME%/.bash_utils/os.sh20
-rw-r--r--%HOME%/.bash_utils/path.sh3
-rw-r--r--%HOME%/.bash_utils/text.sh23
8 files changed, 57 insertions, 45 deletions
diff --git a/%HOME%/.bash_utils/alternatives.sh b/%HOME%/.bash_utils/alternatives.sh
index 1d10692..3bd4b5f 100644
--- a/%HOME%/.bash_utils/alternatives.sh
+++ b/%HOME%/.bash_utils/alternatives.sh
@@ -9,7 +9,7 @@ alias update-my-alternatives='update-alternatives --quiet --altdir ~/.local/etc/
setup_alternatives_cc() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
gcc_cc="$( command -v gcc 2> /dev/null )" || return 0
gcc_cxx="$( command -v g++ 2> /dev/null )" || return 0
@@ -25,7 +25,7 @@ setup_alternatives_cc() (
setup_alternatives() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
command -v update-alternatives > /dev/null 2>&1 || return 0
mkdir -p -- ~/.local/etc/alternatives ~/.local/var/lib/alternatives
@@ -37,7 +37,7 @@ setup_alternatives
alt_gcc() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
gcc_cc="$( command -v gcc 2> /dev/null )"
update-my-alternatives --set cc "$gcc_cc"
@@ -45,7 +45,7 @@ alt_gcc() (
alt_clang() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
clang_cc="$( command -v clang 2> /dev/null )"
update-my-alternatives --set cc "$clang_cc"
diff --git a/%HOME%/.bash_utils/cxx.sh b/%HOME%/.bash_utils/cxx.sh
index 5ad27ca..58470bb 100644
--- a/%HOME%/.bash_utils/cxx.sh
+++ b/%HOME%/.bash_utils/cxx.sh
@@ -35,7 +35,7 @@ _runc_get_absolute_path() {
_runc_usage() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local prefix="${FUNCNAME[0]}"
[ "${#FUNCNAME[@]}" -gt 1 ] && prefix="${FUNCNAME[1]}"
@@ -50,7 +50,8 @@ _runc_usage() (
runc() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local -a c_flags=(${runc_flags[@]+"${runc_flags[@]}"})
local -a src_files=()
@@ -156,7 +157,7 @@ runc() (
runcxx() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local -a runc_flags=(${runcxx_flags[@]+"${runcxx_flags[@]}"})
BASH_ENV=<( declare -p runc_flags ) \
diff --git a/%HOME%/.bash_utils/distr.sh b/%HOME%/.bash_utils/distr.sh
index 7a1996b..1a42afd 100644
--- a/%HOME%/.bash_utils/distr.sh
+++ b/%HOME%/.bash_utils/distr.sh
@@ -10,7 +10,7 @@ sums_name="$( basename -- "$sums_path" )"
_sums_unescape_path() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 1 ]; then
echo "usage: ${FUNCNAME[0]} PATH" >&2
@@ -25,7 +25,7 @@ _sums_unescape_path() (
sums_list_paths() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local print_lines=
local print_sums=
@@ -97,7 +97,8 @@ sums_list_paths() (
sums_add() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local -A existing
local -a missing=()
@@ -118,7 +119,8 @@ sums_add() (
sums_add_all() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local -a paths
@@ -132,7 +134,8 @@ sums_add_all() (
sums_add_distr() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local -a paths
local path
@@ -156,14 +159,15 @@ sums_add_distr() (
sums_verify() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
sha1sum --check --strict --quiet -- "$sums_path"
)
sums_remove_missing() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local dry_run=
diff --git a/%HOME%/.bash_utils/file.sh b/%HOME%/.bash_utils/file.sh
index 351b962..c434fdb 100644
--- a/%HOME%/.bash_utils/file.sh
+++ b/%HOME%/.bash_utils/file.sh
@@ -7,7 +7,7 @@
swap_files() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} PATH1 PATH2" >&2
@@ -40,7 +40,7 @@ swap_files() (
pastebin() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 1 ]; then
echo "usage: ${FUNCNAME[0]} PATH" >&2
diff --git a/%HOME%/.bash_utils/git.sh b/%HOME%/.bash_utils/git.sh
index 23f9ee1..c0aecf4 100644
--- a/%HOME%/.bash_utils/git.sh
+++ b/%HOME%/.bash_utils/git.sh
@@ -10,7 +10,7 @@ alias branch_dirs='git ls-tree -r --name-only HEAD -d'
workdir_is_clean() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local status
status="$( git status --porcelain )"
@@ -23,7 +23,8 @@ workdir_is_clean() (
branch_eol_normalized() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
workdir_is_clean
@@ -59,7 +60,8 @@ branch_eol_normalized() (
branch_doslint() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local -a paths
@@ -73,7 +75,8 @@ branch_doslint() (
branch_lint() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local -a paths
@@ -87,7 +90,7 @@ branch_lint() (
branch_backup() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local repo_dir
repo_dir="$( git rev-parse --show-toplevel )"
@@ -114,7 +117,8 @@ branch_backup() (
git_replace() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} STR SUB" 1>&2
@@ -129,7 +133,8 @@ git_replace() (
git_replace_word() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} STR SUB" 1>&2
diff --git a/%HOME%/.bash_utils/os.sh b/%HOME%/.bash_utils/os.sh
index d2e4b1c..d0f9017 100644
--- a/%HOME%/.bash_utils/os.sh
+++ b/%HOME%/.bash_utils/os.sh
@@ -65,7 +65,7 @@ os_is_linux() { os_is_ubuntu_like || os_is_arch || os_is_fedora ; }
pkg_list_cygwin() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
cygcheck --check-setup --dump-only \
| tail -n +3 \
@@ -76,7 +76,7 @@ pkg_list_cygwin() (
setup_pkg_list_ubuntu() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local -r initial_status='/var/log/installer/initial-status.gz'
@@ -88,7 +88,7 @@ setup_pkg_list_ubuntu() (
user_pkg_list_ubuntu() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local manual
manual="$( apt-mark showmanual | sort | uniq )"
@@ -101,7 +101,7 @@ user_pkg_list_ubuntu() (
pkg_list_ubuntu() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
dpkg --get-selections \
| grep --invert-match -- 'deinstall$' \
@@ -113,7 +113,7 @@ pkg_list_ubuntu() (
setup_pkg_list_arch() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
# Assuming you only selected groups 'base and 'base-devel' during
# installation.
@@ -124,7 +124,7 @@ setup_pkg_list_arch() (
user_pkg_list_arch() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
local manual
manual="$( pacman -Q --explicit -q | sort )"
@@ -137,7 +137,7 @@ user_pkg_list_arch() (
manual_pkg_list_arch() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
expac '%n %p' | grep 'Unknown Packager'
)
@@ -150,7 +150,7 @@ pkg_list_arch() {
pkg_list_fedora() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
rpm --queryformat="%{NAME}\n" -qa | sort
)
@@ -159,7 +159,7 @@ pkg_list_fedora() (
pkg_list() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if os_is_cygwin; then
pkg_list_cygwin
@@ -177,7 +177,7 @@ pkg_list() (
user_pkg_list() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if os_is_ubuntu_like; then
user_pkg_list_ubuntu
diff --git a/%HOME%/.bash_utils/path.sh b/%HOME%/.bash_utils/path.sh
index 326cbf7..20c6a31 100644
--- a/%HOME%/.bash_utils/path.sh
+++ b/%HOME%/.bash_utils/path.sh
@@ -11,7 +11,8 @@
path_add() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
[ "$#" -eq 0 ] && return 0
diff --git a/%HOME%/.bash_utils/text.sh b/%HOME%/.bash_utils/text.sh
index ea5b1af..cdda01e 100644
--- a/%HOME%/.bash_utils/text.sh
+++ b/%HOME%/.bash_utils/text.sh
@@ -28,7 +28,7 @@ doslint() {
_sed_escape_pattern() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 1 ]; then
echo "usage: ${FUNCNAME[0]} STR" >&2
@@ -52,7 +52,7 @@ _sed_escape_pattern() (
_sed_escape_substitution() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 1 ]; then
echo "usage: ${FUNCNAME[0]} STR" >&2
@@ -69,7 +69,7 @@ _sed_escape_substitution() (
file_replace() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -lt 3 ]; then
echo "usage: ${FUNCNAME[0]} OLD NEW PATH..." >&2
@@ -88,7 +88,7 @@ file_replace() (
file_replace_word() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -lt 3 ]; then
echo "usage: ${FUNCNAME[0]} OLD NEW PATH..." >&2
@@ -107,7 +107,7 @@ file_replace_word() (
str_replace() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 3 ]; then
echo "usage: ${FUNCNAME[0]} STR SUB REP" >&2
@@ -125,7 +125,7 @@ str_replace() (
_bash_escape_pattern() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 1 ]; then
echo "usage: ${FUNCNAME[0]} STR" >&2
@@ -145,7 +145,7 @@ _bash_escape_pattern() (
str_contains() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} STR SUB" >&2
@@ -163,7 +163,7 @@ str_contains() (
str_starts_with() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} STR SUB" >&2
@@ -181,7 +181,7 @@ str_starts_with() (
str_ends_with() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} STR SUB" >&2
@@ -199,7 +199,8 @@ str_ends_with() (
str_split() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit lastpipe
+ shopt -s inherit_errexit 2> /dev/null || true
+ shopt -s lastpipe
local fmt='%s\n'
local -a args
@@ -254,7 +255,7 @@ str_split() (
str_join() (
set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
+ shopt -s inherit_errexit 2> /dev/null || true
if [ "$#" -lt 1 ]; then
echo "usage: ${FUNCNAME[0]} DELIM [STR]..." >&2