@alosarjos please apply also this patch to improve handling of comments and whitespace:
diff --git a/brave-bin.sh b/brave-bin.sh
index 0e657ed..30940d1 100644
--- a/brave-bin.sh
+++ b/brave-bin.sh
@@ -4,7 +4,7 @@ XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
# Allow users to override command-line options
USER_FLAGS_FILE="$XDG_CONFIG_HOME/brave-flags.conf"
if [[ -f "$USER_FLAGS_FILE" ]]; then
- mapfile -t USER_FLAGS < <(sed 's/#.*//g' "$USER_FLAGS_FILE")
+ mapfile -t USER_FLAGS < <(sed -e 's/\s*#.*//g' -e 's/^\s*//g' -e 's/\s*$//g' "$USER_FLAGS_FILE"|sed -n '/\S/p')
fi
export CHROME_VERSION_EXTRA="stable"
This takes care of trimming whitespace around options and dropping lines that contain no options, which is relevant when you quote everything you pass on the command line.
PS. The approach you took to removing comments (which I haven't changed) would be problematic if a browser option was used with an argument containing the #
character, like --some-option=foo#bar
, but that seems like an unlikely edge case, so I think it's fine to favor simplicity of implementation here.
Pinned Comments
brave commented on 2025-04-25 13:00 (UTC)