Managing system configuration with hg?
Ed Santiago
ed at edsantiago.com
Wed Jan 31 22:25:35 UTC 2007
>> status=$(hg status)
>> [...]
>> hg status | sed -e 's/^/ /'
>
>What about running hg status just once and replacing the second call
>with a simple echo command?
>
>echo "$status" | sed -e 's/^/ /'
The newlines will be lost:
$ printf "a b c\ndef\n"
a b c
def
$ foo=$(!!);echo $foo
a b c def
It's possible to work around this in several ways, eg $IFS or
by doing the indentation in the status=$(...) itself. Each
has its tradeoffs, and this was just a quick hack anyway.
I've spent more time writing this email than on the script
itself. I wasn't striving for perfection :-)
^E
--
Ed Santiago Toolsmith ed at edsantiago.com
More information about the Mercurial
mailing list