Hi,
I try to wrote a little script.
When _DEBUG=="off", the last 2 lines
are executed. But, when _DEBUG=="on"
the last 2 lines should give on the
console :
mv toto tata
cat tata >> tutuNow, i get only the first line :
mv toto tataand also :
$
cat tutucat tataThe problem seems to be with the redirection (>>).
How can i modify my script to reach my goal ?
Thank you.
Guy
Code:
#!/bin/bash
_DEBUG="on"
function DEBUG()
{
[ "$_DEBUG" == "on" ] && echo -E "$@"
[ "$_DEBUG" == "off" ] && $@
}
#_DEBUG="off"
cd /tmp
echo "test" > toto
DEBUG mv toto tata
DEBUG cat tata >> tutu