shell - How can I prepend a default value to all echo calls in a bash script -
i have bash script containing multiple echo
calls:
#!bin/bash echo 'a' echo 'b' echo 'c'
i want prepend default text of these echo calls output this:
default_text: default_text: b default_text: c
is there way globally inside script without adding default text each 1 of echo calls?
note: below there 2 answers question. 1 accepted resolves problem echo
commands. second 1 resolves problem globally inside script any command outputs stdout.
define function:
function echo { builtin echo 'default_text: ' "$@" ; }
the builtin
needed, otherwise function recursive.
Comments
Post a Comment