profile: bail out early if promptvars is disabled

We need promptvars, otherwise the prompt strings won't undergo parameter
expansion and we'd print them literally:

$ shopt -u promptvars
$ echo foo
$(__systemd_osc_context_ps0)foo

Resolves: #40620
This commit is contained in:
Frantisek Sumsal
2026-05-14 23:17:40 +09:00
committed by Yu Watanabe
parent 7330e9c789
commit 7d1b6b7b96
+4
View File
@@ -21,6 +21,10 @@
# Treat missing $TERM same as "dumb".
[ "${TERM:-dumb}" = "dumb" ] && return 0
# We need promptvars, otherwise the prompt strings won't undergo parameter expansion
# and we'd print them literally
shopt -q promptvars || return 0
__systemd_osc_context_escape() {
# Escape according to the OSC 3008 spec. Since this requires shelling out
# to 'sed' we'll only do it where it's strictly necessary, and skip it when