On Do, 07 Apr 2016, David Champion wrote: > > but printf for parameterised output: > > > > printf '%s\n' "$arbitrary_value" > > I've started leaning on printf for newline-less printing lately -- it's > just easier. But you must be careful to use 'printf %s "$foo"' instead > of just 'printf $foo', since otherwise a % in input can thwart. > > > and I have my own script "necho" for "echo with no newline" for the > > appropriat platform (or I make a shell function necho() calling printf for > > the same purpose, depending on context). Then one can go: > > Let's see if I can get this right from memory: > case "`echo -n`" in) > -n) necho () { echo "$@""\c"; };; > *) necho () { echo -n "$@"; };; > esac
I mentioned Sven Maschecks Website before and he has some information about echo/printf as well http://www.in-ulm.de/~mascheck/various/echo+printf/ > > Speaking of which, it's taken me until the last year to use $(command) > consistently instead of `command`, and I'm not sure anymore why I was > a stickler. I assume some older shell didn't support $() but I can't > recall which. http://www.in-ulm.de/~mascheck/various/cmd-subst/ And the other pages are worth a look as well, if one is interested in those things. regards, Christian