Any $VAR in command line after <-e> option gets replaced with its value despite of enclosing with single quotes Reproducible: Always Steps to Reproduce: $ konsole -e bash -c 'echo $SHELL;echo '\''$SHELL'\'';read' Actual Results: /bin/bash /bin/bash Expected Results: /bin/bash $SHELL 1. Lets consider the following command: echo $SHELL;echo '$SHELL';read It prints two lines: expanded and non-expanded $SHELL First line of output: /bin/bash Second line of output: $SHELL 2. Wrap the command from step #1 with single quotes: 'echo $SHELL;echo '\''$SHELL'\'';read' 3. Append <bash -c> to the string from step #2: bash -c 'echo $SHELL;echo '\''$SHELL'\'';read' This command does exactly the same as command from step #1. 4. Use some other terminal emulator (for example, xterm) to use command from step #3 as argument for <-e> option: xterm -e bash -c 'echo $SHELL;echo '\''$SHELL'\'';read' It works as expected: it prints expanded $SHELL and non-expanded $SHELL: /bin/bash $SHELL 5. Now test the command from step #3 with <-e> option using konsole: konsole -e bash -c 'echo $SHELL;echo '\''$SHELL'\'';read' It prints: /bin/bash /bin/bash konsole seems to always expand environment variables in <-e command args>. This behavior looks like a bug.
I would agree it is a bug
I think the unit test committed in 595adcd7e95ac050a4346b526164f791050691a7 is incorrect, "$SHELL" should still be expanded, but '$SHELL' should not?
echo $SHELL;echo '\''$SHELL'\'' The first should be expanded, the 2nd not, correct?
the second example is missing a '? but the test now tests basically «echo "$SHELL"», if I understand correctly, and that should be expanded, but «echo "$SHELL"» should not.
Still relevant today.