Ok, my Unix scripting skills are obviously really rusty. All I want to do is have a file with 4 arguments that I want passed to a script as if they came from the command line. But strangely doing this:
./myscript.sh < mycmds.txt
Doesn't seem to be working the way I expect. Contents of myscript.sh are:
cat >> out.txt <<EOF
$1 $2 $3 $4
EOF
So if I run myscript.sh from the command line like this: ./myscript.sh test1 test2 test3 test4 everything works great and I see test1 test2 test3 test4 show up in the out.txt file. But if I put test1 test2 test3 test4 as a line in a file called mycmds.txt and then run ./mysript.sh < mycmds.txt I just get an empty line in out.txt file.
So what am I doing wrong here? What is the proper way to store arguments in a file and pass them to a script so that they will be treated just as if they came from the command line?