aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils/cxx.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-04-02 08:18:01 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-04-02 13:39:59 +0300
commit42da15c1fbff60c4a49705b96ebb30721ccafb14 (patch)
tree3b86ccf4fd01e7224b5e401ba14cd49cee78ebae /%HOME%/.bash_utils/cxx.sh
parent.bash_utils: remove mysql.sh (diff)
downloadlinux-home-42da15c1fbff60c4a49705b96ebb30721ccafb14.tar.gz
linux-home-42da15c1fbff60c4a49705b96ebb30721ccafb14.zip
bash: best practices & linting
Diffstat (limited to '%HOME%/.bash_utils/cxx.sh')
-rw-r--r--%HOME%/.bash_utils/cxx.sh21
1 files changed, 15 insertions, 6 deletions
diff --git a/%HOME%/.bash_utils/cxx.sh b/%HOME%/.bash_utils/cxx.sh
index 3aaa918..d094f3f 100644
--- a/%HOME%/.bash_utils/cxx.sh
+++ b/%HOME%/.bash_utils/cxx.sh
@@ -7,6 +7,8 @@
_runc_os_is_cygwin() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit
+
local os
os="$( uname -o )"
test 'Cygwin' = "$os"
@@ -38,6 +40,7 @@ _runc_get_absolute_path() {
_runc_usage() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit
local prefix="${FUNCNAME[0]}"
[ "${#FUNCNAME[@]}" -gt 1 ] && prefix="${FUNCNAME[1]}"
@@ -52,6 +55,7 @@ _runc_usage() (
runc() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit lastpipe
local -a c_flags=(${runc_flags[@]+"${runc_flags[@]}"})
local -a src_files=()
@@ -111,22 +115,22 @@ runc() (
src_files=()
local src_file
- while IFS= read -d '' -r src_file; do
+ _runc_get_absolute_path ${_src_files[@]+"${_src_files[@]}"} | while IFS= read -d '' -r src_file; do
src_files+=("$src_file")
- done < <( _runc_get_absolute_path ${_src_files[@]+"${_src_files[@]}"} )
+ done
if [ "${#include_dirs[@]}" -gt 0 ]; then
local include_dir
- while IFS= read -d '' -r include_dir; do
+ _runc_get_absolute_path ${include_dirs[@]+"${include_dirs[@]}"} | while IFS= read -d '' -r include_dir; do
c_flags+=("-I$include_dir")
- done < <( _runc_get_absolute_path ${include_dirs[@]+"${include_dirs[@]}"} )
+ done
fi
if [ "${#lib_dirs[@]}" -gt 0 ]; then
local lib_dir
- while IFS= read -d '' -r lib_dir; do
+ _runc_get_absolute_path ${lib_dirs[@]+"${lib_dirs[@]}"} | while IFS= read -d '' -r lib_dir; do
c_flags+=("-L$lib_dir")
- done < <( _runc_get_absolute_path ${lib_dirs[@]+"${lib_dirs[@]}"} )
+ done
fi
if [ "${#libs[@]}" -gt 0 ]; then
@@ -157,6 +161,8 @@ runc() (
runcxx() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit
+
local -a runc_flags=(${runcxx_flags[@]+"${runcxx_flags[@]}"})
BASH_ENV=<( declare -p runc_flags ) \
runc_compiler="${runcxx_compiler:-g++}" \
@@ -165,6 +171,7 @@ runcxx() (
_runc_gdb() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} BINARY CORE_DUMP" >&2
@@ -179,6 +186,7 @@ _runc_gdb() (
_runc_lldb() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit
if [ "$#" -ne 2 ]; then
echo "usage: ${FUNCNAME[0]} BINARY CORE_DUMP" >&2
@@ -193,6 +201,7 @@ _runc_lldb() (
runc_debug() (
set -o errexit -o nounset -o pipefail
+ shopt -s inherit_errexit
if [ "$#" -ne 1 ]; then
echo "usage: ${FUNCNAME[0]} BINARY" >&2