Hi have an easy C program that does the following when I run it with ./a.out
Please enter your name:
What I want to do, is I want to automatically pass the name without having to wait for the prompt. I tried ./a.out Sam, but it would still prompt for a name. I'm trying to write a bash script that would do that.
Any help would be appreciated. Note: I don't want to modify the C source. All I want to do is be able to pass the first argument without having to wait for the prompt.
argc/argvparameters inint main( int argc, char **argv ).argcis the total number of arguments on the command line (including the command that invokes the program),argv[0]is the command you used to invoke the program, andargv[1]throughargv[N-1]are the additional arguments you passed on the command line (represented as text strings).