Answer the question
In order to leave comments, you need to log in
How to run a set of commands from a variable in a bash script?
Good evening! There is a small script that should check the output of two programs (the standard shell and my shell): here is the script
#!/bin/bash
a=0
function test {
./minishell -c "$cmd" > dest
($cmd) > src
echo "Test: " "$cmd"
diff dest src >> diff
if [ "$?" -eq "$a" ]
then
echo -e "\033[37;20;42m OK \033[0m"
else
echo -e "\033[37;40;41m KO \033[0m"
fi
}
rm -f diff
cmd='echo 12'
test
cmd='echo 12 | cat -e'
test
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question