Skip to content

Bash shell PROMPT_COMMAND breaks after giving specific command #7486

@kx1t

Description

@kx1t

Creating a bug report/issue

  • I have searched the existing open and closed issues

Required Information

  • DietPi version | 9.11 RC2 master/MichaIng
  • Distro version | bookworm 0
  • Kernel version | Linux coriovallum 6.12.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) aarch64 GNU/Linux
  • SBC model | RPi 4 Model B (aarch64) 4Gb
  • Power supply used |
  • SD card used | Samsung Evo Endurance 128 Gb

Additional Information (if applicable)

  • I replicated this issue on 2 other machines with DietPi 9.11RC2 (1x RPi4B/4Gb, 1x Intel x86 machine)

Steps to reproduce

  1. Open a bash shell into a non-root account
  2. Check that all works fine by giving some random commands
  3. Provide this command: if [[ ]]; then echo true; else echo false; fi
  4. Observe error messages printed after each subsequent command
-bash: PROMPT_COMMAND: line 38: syntax error near unexpected token `-w'
-bash: PROMPT_COMMAND: line 38: `[[ -w '/tmp/dietpi-process.pid' ]] && rm -f /tmp/dietpi-process.pid &> /dev/null && echo -ne '\r\e[J'; '
  1. Log out, log in, repeat steps 2-4 to replicate the issue
  2. To stop seeing the issue within the same shell (without logging out), type any text and then interrupt with CTRL-C before pressing the <Return key

Expected behaviour

  • Command should return within the expected behavior of bash without any subsequent issues

Actual behaviour

  • After each subsequent command, the error message (see below) is printed
  • After waiting for some time, the error message is no longer printed after a command

Extra details

See this sequence:

pi@coriovallum:~$ echo hello
hello
pi@coriovallum:~$ echo this is a test
this is a test
pi@coriovallum:~$ if [[ ]]; then echo true; else echo false; fi
-bash: PROMPT_COMMAND: line 37: syntax error near unexpected token `-w'
-bash: PROMPT_COMMAND: line 37: `[[ -w '/tmp/dietpi-process.pid' ]] && rm -f /tmp/dietpi-process.pid &> /dev/null && echo -ne '\r\e[J'; '
pi@coriovallum:~$ echo hello
hello
-bash: PROMPT_COMMAND: line 38: syntax error near unexpected token `-w'
-bash: PROMPT_COMMAND: line 38: `[[ -w '/tmp/dietpi-process.pid' ]] && rm -f /tmp/dietpi-process.pid &> /dev/null && echo -ne '\r\e[J'; '
pi@coriovallum:~$ echo this is a test
this is a test
-bash: PROMPT_COMMAND: line 39: syntax error near unexpected token `-w'
-bash: PROMPT_COMMAND: line 39: `[[ -w '/tmp/dietpi-process.pid' ]] && rm -f /tmp/dietpi-process.pid &> /dev/null && echo -ne '\r\e[J'; '
pi@coriovallum:~$ some-random-text^C
pi@coriovallum:~$ echo hello this is a test
hello this is a test
pi@coriovallum:~$

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions