PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] as a command line argument
Date: Wednesday, 21 Oct 2020, 07:30:22


    > Message Posted By: Unknown
    >
    > I notice that when I run
    >
    > /c/cs323/Hwk3/McBash a $1
    >
    > With stdin of "$2", the program prints an empty string. Is this behavior
    > due to the $ in the command line argument?

As you can verify by running

  % echo a $1 b

bash expands the $1 to the empty string prior to
breaking the command line into arguments.  Thus
there is no second argument and Hwk3/mcBash expands
$2 to the empty string.

--Stan-
PREV INDEX NEXT