Thanks to all! Your suggestion works reply helped.
--
Prabhjot
On Thu, Jun 11, 2009 at 10:18 AM, sujay g <mail.sujayg@...> wrote:
>
>
> bash is interpreting * and passing it as the list of files in the
> current directory, you could try passing escape sequence with * and
> see what is the behavior.
> -sujay
>
> On Wed, Jun 10, 2009 at 8:02 PM, prabhjot
> singh<prabhjotsinghengineer@... <prabhjotsinghengineer%40gmail.com>>
> wrote:
> >
> >
> > Hi,
> >
> > I write a very simple program to print command line arguments.
> > As and when program hits '*' in received arguments It converts it to list
> of
> > files in current directory.
> >
> > My questions/doubts:
> > 1) What is the reason behind this?
> > 2) Can't I pass * as command line argument?
> >
> > #include <stdio.h>
> > int main(int argc, char *argv[])
> > {
> > int i = 0;
> > printf("argc: [%d]", argc);
> > while (i < 10 && i < argc)
> > printf("%s\n", argv[i++]);
> > }
> > output:-
> >
> >>./a.out *
> > argc: [38]
> > /*here goes list of files*/
> >
> > --
> > Platform used: RH Linux - Bash shell | compiler: gcc [egcs-2.91.66 ]
> >
> > --
> > Thanks
> > PS
> >
> > [Non-text portions of this message have been removed]
> >
> >
>
>
>
[Non-text portions of this message have been removed]