bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

An inconsistency of the outputs of help builtin


From: Wiley Young
Subject: An inconsistency of the outputs of help builtin
Date: Fri, 20 Dec 2024 04:50:17 -0800

Testing how bash's help builtin responds to each character.

For some reason, while `help -d 'c'` prints the same thing as `help -c
'c*'` (note the asterisk), the same is not true when the character is
left-bracket: `help -c '[*'.  This issue persists on bash 5.3 beta.

# Input:
[liveuser@fedora ~]$
fn ()
{
  help -d "$1" 2> /dev/null \
    | sed -e '/^Shell commands matching keyword/d' -e '/^$/d' \
    | wc;
};
for init in {a..z} '%' '(' '.' ':' '[' '{';
do
  str_a=${init};
  str_b="${init}*";
  out_a=$( fn "${str_a}" );
  out_b=$( fn "${str_b}" );
  if [[ ${out_a} != "${out_b}" ]];
  then
    mismatches+=( "${init}" );
  fi;
done;
declare -p mismatches;
unset {str,out}_{a,b} mismatches

# Output:
declare -a mismatches=([0]="[")

# With and without asterisks at (awk-style) field 3
[liveuser@fedora ~]$ help -d '[' | sed -e '/^Shell commands matching
keyword/d' -e '/^$/d' | wc
      1       5      37
[liveuser@fedora ~]$ help -d '[*' | sed -e '/^Shell commands matching
keyword/d' -e '/^$/d' | wc
      2      12      78

# With and without \wc\ at the end of the pipeline.
[liveuser@fedora ~]$ help -d '[' | sed -e '/^Shell commands matching
keyword/d' -e '/^$/d'
[ - Evaluate conditional expression.
[liveuser@fedora ~]$ help -d '[*' | sed -e '/^Shell commands matching
keyword/d' -e '/^$/d'
[ - Evaluate conditional expression.
[[ ... ]] - Execute conditional command.

Thanks,
  Wiley


reply via email to

[Prev in Thread] Current Thread [Next in Thread]