I'm a very new user to bash, so bear with me. I'm trying to run a bash script that will take inputs from the command line, and then run a c program which its output to other c programs. For example, at command line I would enter as follows:
$ ./script.sh -flag file1 < file2
The within the script I would have:
./c_program -flag file1 < file2 | other_c_program
The problem is, -flag, file1 and file2 need to be variable.
Now I know that for -flag and file this is fairly simple- I can do
FLAG=$1
FILE1=$2
./c_program $FLAG FILE1
My problem is: is there a way to assign a variable within the script to file2?
EDIT: It's a requirement of the program that the script is called as $ ./script.sh -flag file1 < file2