int main(int argc, char *argv[]) {
char *strInput = argv[1];
printf("%s\n", strInput);
}
./a.out $6$AS$9IwGTn5WbHSalUs4ba3JbOfOUX/v1yD71Z4M2F6Yusz5k2WQEOFxqLIY80tudGtcFttqr/Zq6RIPjHkl/t2Pp1
When running the following program the characters $6$AS$9 are cut from the input using args. Why is this?
>Solution :
Problem
This isn’t anything to do with your program and how it treats arguments.
Your shell is treating things that start with a $ as shell variables, which are undefined and so expand to nothing. After $9 it treats the rest as text.
Solution
Enclose the argument in single quotes to prevent the shell from expanding variables: '$6$A$9....'