
SMarcell
(usa Slackware)
Enviado em 25/03/2011 - 14:32h
# Simulando um 'if/else' no sed.
$ bc <<< "scale = 2 ; 4 / 6" | sed -e '/^\./ {s/^\./0&/ ; q}' -e 's/^\-/&0/'
0.66
$ bc <<< "scale = 2 ; -4 / 6" | sed -e '/^\./ {s/^\./0&/ ; q}' -e 's/^\-/&0/'
-0.66