I recently upgraded my FreeBSD box and now pythonbrew seems to be broken. It bails out of the .pythonbrew/etc/bashrc file on this line:
PATH_WITHOUT_PYTHONBREW=$(printf "$PATH" | awk -v RS=: -v ORS=: "/${PATH_ROOT//\//\/}/ {next} {print}" | sed -e 's#:$##')
Gives the error:
awk: syntax error at source line 1
context is
>>> //home/myusername/. <<< pythonbrew/ {next} {print}
awk: bailing out at source line 1
That PATH_ROOT variable is
/home/myusername/.pythonbrew
printf "%s" "$PATH"
instead of printf "$PATH"
.'/'"${PATH_ROOT//\//\/}"'/{...}'
instead of "/${PATH_ROOT//\//\/}/{...}"
awk -v path_root="${PATH_ROOT//\//\/}" '$0 ~ path_root{...}'
instead of '/'"${PATH_ROOT//\//\/}"'/{...}'
.So, all together, as a starting point your script would be:
PATH_WITHOUT_PYTHONBREW=$(printf "%s" "$PATH" |
awk -v path_root="${PATH_ROOT//\//\/}" 'BEGIN{RS=ORS=":"} $0 !~ path_root' |
sed -e 's#:$##')
assuming your PATH_ROOT manipulation makes sense.
It could be further improved but that should be enough to get rid of your error.