bug-bash
[Top][All Lists]
Advanced

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

documentation for ${!prefix*} is misleading


From: Greg Wooledge
Subject: documentation for ${!prefix*} is misleading
Date: Tue, 10 Aug 2010 09:49:39 -0400
User-agent: Mutt/1.4.2.3i

The 4.1 man page says:

      ${!prefix*}
      address@hidden
           Names matching prefix.  Expands to the names of variables whose
           names begin with prefix, separated by the first character of the
           IFS special variable.  When @ is used and the expansion appears
           within double quotes, each variable name expands to a separate
           word.

Actually, the IFS rule only applies when the "${!prefix*}" is quoted.

  imadev:~$ IFS='+x'
  imadev:~$ echo ${!P*}
  P4CLIENT PAGER PATH PIPESTATUS PKG_CONFIG_PATH PPID PS1 PS2 PS4 PWD
  imadev:~$ echo "${!P*}"
  P4CLIENT+PAGER+PATH+PIPESTATUS+PKG_CONFIG_PATH+PPID+PS1+PS2+PS4+PWD

Or, using a special script to see the arguments more clearly:

  imadev:~$ args ${!P*}
  10 args: <P4CLIENT> <PAGER> <PATH> <PIPESTATUS> <PKG_CONFIG_PATH> <PPID> 
<PS1> <PS2> <PS4> <PWD>
  imadev:~$ args "${!P*}"
  1 args: <P4CLIENT+PAGER+PATH+PIPESTATUS+PKG_CONFIG_PATH+PPID+PS1+PS2+PS4+PWD>

I believe this is intended behavior (since it matches how $* works),
and that the man page is simply misleading.



reply via email to

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