Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit d3bffa7

Browse files
committed
lib/builtins.sh: add ab_trim_args function ...
... this function trims inner whitespaces inside a string
1 parent 3d64896 commit d3bffa7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/builtins.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,13 @@ ab_match_archgroup() {
7474
abinfo "All architecture group members '${ABHOST_GROUP//$'\n'/,}' mismatches $1: taking false branch."
7575
return 1
7676
}
77+
78+
## ab_trim_args var
79+
## Minimize the whitespace characters inside the variable "$var"
80+
## NOTE: This function modifies the variable IN-PLACE and does not return any value.
81+
## Example: ab_trim_args CFLAGS
82+
ab_trim_args() {
83+
local arg
84+
declare -n arg="$1"
85+
arg="$(tr -s ' ' <<< "${arg}")"
86+
}

0 commit comments

Comments
 (0)