Skip to content

${var@P}: \# command-number escape expands to 0 in scripts (GNU counts executed commands); set -o column width off by one #393

Closed

Description

@caomengxuan666

Found during wt33 triage of #374. Two small formatting/param divergences, both GNU-verified via script-file probes under target/issue-suites/results/wt33-373/run/.

1. ${var@P} \# escape

H09_typeset_int_compound.sh tail:

p='history=\! command=\#'
echo "${p@P}"

GNU 5.3.0: history=1 command=7 (the 7 counts commands executed so far in the script)
rubash: history=1 command=0

(\! already matches: 1 on both.)

2. set -o readable column width

H07_set_o_spacing.sh: set -o | grep -E '^(pipefail|emacs)' | cat -A
GNU 5.3.0: emacs ^Ioff$ / pipefail ^Ioff$ (name padded to a 16-char column)
rubash: one extra space of padding (17-char column)

Tests left tracking: part_066 test_parameter_prompt_transform_expands_history_and_command_count_escapes (#[ignore] -> this issue; its old expectation history=0 was wrong for GNU too), part_022 test_shopt_o_uses_readable_format_without_print_flag (#[ignore] -> this issue).

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added a commit that references this issue on Oct 2, 2026
  3. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Landed as 7877a7c: ${var@P} \# reads a real current_command_number (GNU builtins/... @p transform), shopt -o column width corrected. 6/6 regression suite; 11/12 two-shell probes byte-identical (residual = WinuxCmd cat -A environment item).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions