I worte a bash script that have a few options turned on by switches from command line. I want to create option for the user to run this script in quiet mode which mean - all stdout will be redirected to /dev/null. i use a variable that is changed to /dev/null if the -q switch is on:
while getopts ":qhb:kape" opt; do
case $opt in
q)
output=/dev/null
;;
and later i redirect acho mesagges to output:
echo "something" 1>>$output
My question is how to initilaize this var output above for case of no -q switch were sent. what is the value of standrd stdout destination (the text terminal that called the sctipt usually)?
thanks!