Thread: command line arguments and semi-colon

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    28

    command line arguments and semi-colon

    Hi all,
    I've been playing around on a linux OS Ubuntu 9.04 and I wrote a small program that takes in a string as an argument.

    The string is somewhat complicated so I terminate it with a ; (semi-colon) but for some reason (which I would like to know why) the ; doesn't appear part of the input string.

    For example:

    ./tst <string>;

    and my first line in the program is:

    printf("My argument is: %s\n", argv[1]);

    The semi-colon doesn't show in the string printed. However, if I use a comma , or some other character, it displays fine....

    Any ideas of why this is happening?

    thanks in advance

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Because ; means something to your shell, just like * means something to your shell and & means something to your shell....

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    28
    thanks tabstop!!!

Popular pages Recent additions subscribe to a feed