So I´ve read several times about stdout, stdin and stderr. It sounds like a very simple concept but I don't know why I can't grasp it yet.
Well, I´m working on a script for homework. Part of it is that it will take at least two arguments. If it is less than two arguments, it should print an error on stderr, otherwise it should print the contents of all the files to stdout. (For now lets assume that all the files are text files, I don't want to deal with that yet)
So after reading Linux Pocket guide I have an idea of how to start
#!/bin/bash
if[$# -lt 2]
then
echo $0 error: you must supply two arguments"
else
//stuff
fi
My first question is, the line of code:
echo $0 error: you must supply two arguments"
does that fulfill the requirement of "should print an error on stderr"?
Also, the homework is asking me to name the arguments a1, a2, a3...so on. How can I name the argument?
And last, how can I put everything together, in other words how can I concatenate the files and print them?