From: "Matthew K. Williams" Date: 2011-06-18T03:55:40+09:00 Subject: Re: get execution name of program > On Sat, Jun 18, 2011 at 03:31:20AM +0900, Michael Edgar wrote: >> On Jun 17, 2011, at 2:16 PM, Chad Perrin wrote: >> >>> On Sat, Jun 18, 2011 at 03:03:50AM +0900, Michael Edgar wrote: >>>> >>>> >>>> In bash, `alias` is a builtin; these aliases are expanded by the shell >>>> before the program begins execution. I'm afraid what you wish for is >>>> not feasible. >>> >>> I was afraid of that. Thanks. >> >> If you're desperate, you may find a way to interrogate bash as to its >> current settings/aliases. You could then look at ARGV and find all >> matching aliases. You'd always have ambiguity between an alias vs. >> the expanded form, but you might be able to show an alias was not >> used. > > Yeah . . . but that's much more effort than is warranted by my use case. > I'm just looking for a way to have my program use what one uses to call > the program in the usage banner for a --help option. Frankly, the user > can figure out the alias for him/her self at this point. > > Thanks for the suggestion, anyway. If you're wanting it for a --help usage, then why not use the old hardlink trick? Create hardlinks for the various "aliases" you'd invoke this as, then $0 will be set appropriately. Matt