Why does $_ in $MAILPATH work weirdly?

Gary W. Swearingen garys at opusnet.com
Sat Jun 24 18:41:17 UTC 2006


张森 <sen.zhang at 126.com> writes:
...
> export MAILPATH=’/var/mail/madsen?"You have spool mails!":~/Mail/Inboxes/net9?"madsen at net9 has mails!$_":~/Mail/Inboxes/ce-lab?"zhangsen at ce-lab has mails!"’
...
>
> What drives me crazy is that the $_ in the $MAILPATH's messages just expands to the last argument of the last bash 
> command. But according to the bash's manual, $_ should expand to the mailfile name.

Maybe bash gets confused by the weird quote character just following
"MAILPATH=" (and at the end).  "hd" shows it's 8 bytes long!  It
probably must be a normal single-byte single quote (AKA apostrophe).

You probably copied some example code out of the manpage and got some
funky Unicode character.  A bug in bash manpage, IMO.




More information about the ubuntu-users mailing list