I have a script with some functions (~/func/functions.sh
)
and I have the other script (~/scripts/example.sh
)
Code: functions.sh
#!/bin/bash
function NameofFunction()
{
# do something...
echo -e "\e[31m[ ERROR ]\e[39m more text..." 1>&2
}
Code: example.sh (work well)
#!/bin/bash
. ~/func/functions.sh
function functioninExample()
{
#do something...
NameofFunction ${VAR1} ${VAR2}
}
functioninExample 2>/dev/null
Code: example.sh (doesn't work)
#!/bin/bash
. ~/func/functions.sh
function functioninExample()
{
#do something...
NameofFunction ${VAR1} ${VAR2} 2>/dev/null
}
functioninExample
How can I redirect the echo from my function without editing the function?
NameofFunction ${VAR1} ${VAR2} 2>/dev/null
doesn't work.
How can I redirect the echo from my function without redirecting the functioninExample function?
${VAR1}, ${VAR2}
to some real strings and show us what is your function printing exactly? – rudimeier Sep 28 '16 at 13:15