vidya vidya - 3 months ago 15
Bash Question

Output redirection in shell script not working completely

>cat test.sh
#!bin/bash
testf="/home/vidya/test/"
cd $testf
`make clean all` >/dev/null 2>&1
if [ -e test ]
then
`./test << end
source(scripts/all.src);
quit;
end` >/dev/null 2>&1
echo -e "\nLog Result is:`grep Tests test.log | tail -1`\n"
fi


When I run the above script below is the output.
The problem here is even though I used output redirection while executing test case but still it is printing on console like "Opened file .... " for each file.
It it redirecting most of the test case execution but not completely.
Is there anyway to suppress this output on console ?

[vidya ]$ sh test.sh
Opened file </home/vidya/test/scripts/all.src>
Opened file </home/vidya/test/scripts/file1>
Opened file </home/vidya/test/scripts/file2>
.
.
.
Opened file </home/vidya/test/scripts/file10>

Log Result is: Tests: 1005 PASSED / 48 FAILED

Answer

as sjsam has answered remove the backticks . I think the syntax is like this

./test >/dev/null 2>&1 << end
source(scripts/all.src);
quit;
end