Pi_
Pi_

Reputation: 2120

Shell script to run program that asks for input

I have a C program in which two scanf() are done.

I need to write a shellscript that will run the program and give it the arguments too.

The problem is that all I could come up with is how to pipeline an argument into the program as a command line arguments which is not what I need.

Any help appreciated.

Upvotes: 0

Views: 2498

Answers (1)

John3136
John3136

Reputation: 29265

This should work

echo "some input" | yourprog

e.g. echo "1 1 + p" | dc

Upvotes: 1

Related Questions