[beginner] Why nothing is printed to stdout ?

Graham Fawcett fawcett at uwindsor.ca
Wed Nov 2 07:34:28 PDT 2011


On Wed, 02 Nov 2011 07:56:19 -0400, Steven Schveighoffer wrote:

> On Tue, 01 Nov 2011 14:23:52 -0400, Graham Fawcett <fawcett at uwindsor.ca>
> wrote:
> 
>> On Tue, 01 Nov 2011 07:27:44 -0400, Kagamin wrote:
>>
>>> Steven Schveighoffer Wrote:
>>>
>>>> Oh I remember doing that too :)  Don't feel bad, everyone does this
>>>> at least once.  I hate that stupid test builtin, nobody ever uses it
>>>> anymore.
>>>>
>>>> Note, it's not a command line tool, it's a shell builtin, which is
>>>> why it overrides anything in your search path.
>>>>
>>>> I've since adopted the habit of calling test programs "testme"
>>>> instead of "test" :)
>>>
>>> Huh, must port windows console to linux ^_^
>>
>> Too much work! Just put
>>
>>   alias test='./test'
>>
>> in your .profile, and be happy. :)
> 
> That's a cool trick :)
> 
> However, one issue, if you do happen to run any shell scripts where some
> a**hole insisted on using test instead of the [] form, this will cause
> problems.  There must be some way to check for an interactive shell...

I can't speak for all shells, but bash and zsh don't expand aliases when 
you run a script. From the bash manual:

  Aliases are not expanded when the shell is not interactive, unless the
  expand_aliases shell option is set using shopt (see the description  of
  shopt under SHELL BUILTIN COMMANDS below).

Cheers,
Graham


More information about the Digitalmars-d-learn mailing list