]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
profile: bail out early if promptvars is disabled
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 14 May 2026 11:05:02 +0000 (13:05 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 May 2026 14:17:40 +0000 (23:17 +0900)
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

profile.d/80-systemd-osc-context.sh

index 7d4b9a77f1b3957da16b1bb181faa10d13e88dc0..35bbb924cb720fb6cb7a0e82561b2bacbc2e91b8 100644 (file)
 # 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