Here is a script from Mercurial issue 2743. Call it mq.sh
. I'm trying to get it to do the following things, on Debian squeeze.
Echo commands + standard output + standard error to a file.
Prefix with working directory. Sticking in $PWD doesn't work, as it presumably just keeps using the value from when it was first
sourced.Reset redirection back to normal standard output/error at the end. I'm not sure how to do this, but I imagine I'd have to use
exec
again.I'm calling this with
sh mq.sh
. I'd like to do everything portably (if possible), and it seems exec is bash-specific, so I'm puzzled why this is working. Alsoset -x xtrace
is probably bash specific as well. I got it from the Bash reference manual. Doesn't calling withsh
run everything throughdash
on Debian?
1 currently works, I think. How do I do 2 and 3? And can I have a clarification on 4?
export PS4="$PWD$ "
exec > mq.log 2>&1
export HG="hg-crew"
rm -r main clone
set -o xtrace
$HG init main
cd main
$HG init --mq
$HG qnew foo
echo a > a
$HG add
$HG qref
$HG ci --mq -Am.
cd ..
$HG qclone main clone
cd clone
$HG paths --mq
mv .hg/patches/.hg/hgrc{,.foo}
$HG paths --mq
$HG push --mq
echo b >> a
$HG qref
$HG ci --mq -m.
mv .hg/patches/.hg/hgrc.foo .hg/patches/.hg/hgrc
$HG push --mq
script
that might make your life easier.script — make typescript of terminal session
susv3
on Debian; also older shell manuals. On Debian, bothdash
andposh
are shell with few non-standard extensions.