skip to Main Content

I’ve just compared the $PS1 prompts in .bashrc on two of my Debian machines:

PS1='${debian_chroot:+($debian_chroot)}[33[01;36m]u[33[0;90m]@[33[0;32m]h[33[0;90m]:[33[01;34m]w[33[0;90m]$[33[0m] '

PS1='${debian_chroot:+($debian_chroot)}[33[1;36m]u[33[0;37m]@[33[0;32m]h[33[0;37m]:[33[01;34m]w[33[0;37m]$[33[0m] '

As you see, the first sequence says 33[01;, whereas the second has 33[1; on the same position. Do both mean the same (I guess, bold) or do they mean something different? Any idea why the zero has appeared or disappeared? I have no recollection of having introduced/removed this zero myself. A Web search returns numerous occurrences both with and without zero.

2

Answers


  1. the ESC[#;#m escape is for the console font color. I’ve seen many subtle variations on escape implementations, so I’m not surprised. Regardless I think both should be interpreted the same way

    Login or Signup to reply.
  2. "ANSI" numeric parameters are all decimal integers (see ECMA-48, section 5.4.1 Parameter Representation). In section 5.4.2, it explains

    A parameter string consists of one or more parameter sub-strings, each of which represents a number
    in decimal notation.

    A leading zero makes no difference. Someone noticed the unnecessary character and trimmed it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search