Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
- The problem statement, all variables and given/known data:
- Write a script checkFiles.sh that takes an arbitrary number of file paths from the command line and carries out the same analysis on each one, printing a line containing the file name, a colon, a blank, and then one of the two output strings from Stage 1, for each file in the command line.
For example,
text ./checkFiles.sh /usr/share/dict/words fileType.sh /home/cs252/Assignments/ftpAsst/d3.dat /usr/share/dict/words: Something else fileType.sh: Something else /home/cs252/Assignments/ftpAsst/d3.dat: Windows ASCII
- When you believe that you have your script working, run
text ~cs252/bin/scriptAsst.pl again to check your work.
- Relevant commands, code, scripts, algorithms:
I have another script called fileType.sh
#!/bin/sh
file="$1"
case $(file "$file") in
*"ASCII text, with CRLF line terminators" )
echo "Windows ASCII"
;;
* )
echo "Something else"
;;
esac
- The attempts at a solution (include all code and scripts):
#!/bin/bash
for i in "$@"; do
echo $i":" "`sh ./fileType.sh`"
done
I used the other code for the previous step. So for the new part, the script I wrote appears to be working, however when I test it against the teacher's checker I end up with:
Failed when running: ./checkFiles.sh 'aardvark.cpp' 'bongo.dat' 'cat.dog.bak'
I used the tag for urgent since this is due today, but if it's too late for me, I'd still love to understand this. I may fail the course (pass or fail so one fail means total fail) but that doesn't stop me from learning. Thanks ahead of time to anyone reading this!
Oh and the forum won't let me link the course since I don't have 5 post.
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Old Dominion University, Norfolk VA USA, Professor Steven Zeil, CS252
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).