I am given an assignment like this: Write a Bash script that takes a *.tex file as command-line argument and checks if the file executes correctly without any errors. If it executes without any error and warning, assign a mark of 2 to that file. (1 mark if it compiled with a warning, and 0 marks if it shows an error). I am able to assign marks for files which executed without any warnings and for files which gave a warning. Here, I am giving some of the lines of my code,#!/bin/bashrm t.txtpdflatex $1 >> t.txtmessage=`tail -2 t.txt|grep -i output|cut -c 1-6`After executing the command pdflatex, my script searches for appropriate words like output and warning, and accordingly assigns marks. But in the case of a file which has errors, the pdflatex command exits only if we give a 'x'. Since it is expecting an 'x' from the user, it waits there. If I run the script, it is not showing any output; but if I print an x, it assigns the mark to that file as zero.But I have to give this program to an automatic code-evaluator which checks for my code, and tells if my code is correct for all the cases...How do I accomplish that?
dealing with un-executable commands inside a shell-script
shell script;io