Please see the attached
Printable View
Please see the attached
Since the OP was to lazy to actually write it out:
Quote:
Ok here is my C program below. I want to write a shell script that will interact with the program below and print out just the input from the user to the screen.
Program:
How do I create a shell script to print out only the inputs?Code:#include <stdio.h>
main()
{
float a , b;
printf("Input two numbers... \n");
scanf("%f%f" , &a , &b);
printf("%f , a , b );
}
search google takes like two seconds. I don't know what shell you are in I'll assume bashhere is a simple site bash programmingCode:#!/bin/sh
echo Input two numbers:
read num1
read num2
echo "The two numbers are $num1 and $num2"
I am using the C Shell
Consider this a warning to go use something else
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
I have to use it for my assignment.
I just want to write a shell script that outputs the numbers that the user inputs. The above program is called nprog.c and it prints to an output file called nprog
I have writtten a shell script the is called the_script. Within the_script I have:
#!/bin/csh -f
nprog
From this I can type the_script and the program will run. The problem is I don't want the entire program to print. I just want to be able to get the numbers that was inputed and stored into nprog to be printed out.