/etc/passwd and "&" char

jb jb.1234abcd at gmail.com
Mon Oct 29 08:28:29 UTC 2012


Hi,

Question:
What is the purpose of the "&" char in GECOS fields, e.g. user's name field, in
/etc/passwd file ?

$ grep "&" /etc/passwd
root:*:0:0:Charlie &:/root:/bin/csh
operator:*:2:5:System &:/:/usr/sbin/nologin
svn:*:1002:1002:User &:/home/svn:/usr/sbin/nologin

The field containing "&" char represents "-c comment" option in pw(8), which
sets up GECOS fields (user's full name, etc).

The pw(8) states further:
...
     The pw utility allows 8-bit characters in the passwd GECOS field ...
     ...
                                Using 8-bit characters may also affect other
     programs that transmit the contents of the GECOS field over the Internet,
     such as fingerd(8), and a small number of TCP/IP clients, such as IRC,
     where full names specified in the passwd file may be used by default.
...

http://en.wikipedia.org/wiki/Ampersand
...
Encoding and display
...
Programming languages
...
  The ampersand character is used as a special character in at least some
  versions of the database software originally created in Denmark under the
  name Navision (the software has since been acquired by Microsoft). Using this
  character in either "Text" or "Code" fields could create difficulties for
  performing certain tasks in Navision, such as filtering records (either by
  the user or by programming). It is also used as described below to indicate
  shortcuts in menu items and lab els.
...
Text markup
  In SGML, XML, and HTML, ... This creates what is known as the ampersand
  problem. ...
...
Unix shells
...
Web standards
...

Google search results for "& character":
Special (escape) characters in SGML, HTML and XML documents:
&   &   &       ampersand

jb




More information about the freebsd-questions mailing list