[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

"echo" literally in sh scripts (was: why would "tr --complement --squeeze-repeats ..." append the substitution char once more? ...)



> 1) Many implementations of echo will interpret parts of their argument(s),
>    in addition to processing options like -n.  If you want to print a
>    variable's contents to standard output without *any* interpretation,
>    use printf.
>
>     printf %s "$myvar"
>     printf '%s\n' "$myvar"

Interesting.  I used the following instead:

    bugit_echo () {
        # POSIX `echo` has all kinds of "features" we don't want, such as
        # handling of \c and -n.
        cat <<ENDDOC
    $*
    ENDDOC
    }


-- Stefan


Reply to: