The problem statement, all variables and given/known data:
1)Write a shell script that can uses two types of files as inputs, apache.log and apache.error.log
2)Make it so that you can switch between the two file types
3)Make it so that the script writes the output in the terminal, and it is easily readable (use whitespace characters to separate the columns)
The attempts at a solution (include all code and scripts):
for task 2)
#!/bin/sh
echo "What type of file's contents would you like for me to print? 1 - apache.log, 2 - apache.error.log"
read NUM
case $NUM in
1) # Print out apache.log's contents ;;
2) # Print out apache.error.log's contents ;;
*) echo "INVALID INPUT!" ;;
esac
I don't know how I could do task 3)
Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of Miskolc, Miskolc, Hungary, Smid L�szl�, GE-BGI
Not bad a start. You now could use shell functions to fulfill the 3rd requirement. I'm not sure what that exactly is, but just copying the files to the terminal might be missing it. Wouldn't it be helpful to provide small but representative samples of either log file if you need further assistance?
Do you want to read the log type from terminal, or do you want to pass it from the command line?
Do you know how to get at the script's positional parameters?
How would you describe the respective files' format, so it can be compared / controlled?