summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2013-04-02 12:35:09 +0300
committerTomi Ollila <tomi.ollila@iki.fi>2013-04-02 12:35:09 +0300
commit3fd3c2f7e545d69d42d7a0314b43fe9260327af6 (patch)
tree65fe3019a309f81c7f0c0721449a59c3c605cdff
parent281ac0bd4b50ec4a1a832c688f16361390aaace4 (diff)
indent, clarify
-rw-r--r--remoteusage/aboriginal.mdwn55
1 files changed, 28 insertions, 27 deletions
diff --git a/remoteusage/aboriginal.mdwn b/remoteusage/aboriginal.mdwn
index e00ed6f..a558044 100644
--- a/remoteusage/aboriginal.mdwn
+++ b/remoteusage/aboriginal.mdwn
@@ -15,44 +15,45 @@ from the script will fail.
Write the following code to a file, for example `remote-notmuch.sh`.
- #!/bin/bash
+ #!/bin/bash
- # http://notmuchmail.org/remoteusage/aboriginal/
+ # http://notmuchmail.org/remoteusage/aboriginal/
- set -eu
- #exec 2>>remote-errors; echo -- >&2; set -x # outcomment for debugging
+ set -eu
+ # To trace execution, outcomment next line. Note that emacs input may ...
+ #exec 2>>remote-errors; echo -- >&2; set -x # ... change (no stderr).
- readonly SSH_CONTROL_SOCK='~'/.ssh/master-user@host:22
+ readonly SSH_CONTROL_SOCK='~'/.ssh/master-user@host:22
- readonly notmuch=notmuch
+ readonly notmuch=notmuch
- printf -v ARGS '%q ' "$@" # bash feature
+ printf -v ARGS '%q ' "$@" # bash feature
- readonly SSH_CONTROL_ARGS='-oControlMaster=no -S '$SSH_CONTROL_SOCK
+ readonly SSH_CONTROL_ARGS='-oControlMaster=no -S '$SSH_CONTROL_SOCK
- if ssh -q $SSH_CONTROL_ARGS 0.1 $notmuch $ARGS
- then exit 0
- else ev=$?
- fi
+ if ssh -q $SSH_CONTROL_ARGS 0.1 $notmuch $ARGS
+ then exit 0
+ else ev=$?
+ fi
- # continuing here in case ssh exited with nonzero value.
+ # continuing here in case ssh exited with nonzero value.
- case $* in
- 'config get user.primary_email') echo 'nobody@nowhere.invalid'; exit 0 ;;
- 'config get user.name') echo 'nobody'; exit 0 ;;
- 'count'*'--batch'*) while read line; do echo 1; done; exit 0 ;;
- 'count'*) echo 1; exit 0 ;;
- 'search-tags'*) echo 'errors'; exit 0 ;;
- 'search'*'--output=tags'*) echo 'errors'; exit 0 ;;
- esac
+ case $* in
+ 'config get user.primary_email') echo 'nobody@nowhere.invalid'; exit 0 ;;
+ 'config get user.name') echo 'nobody'; exit 0 ;;
+ 'count'*'--batch'*) while read line; do echo 1; done; exit 0 ;;
+ 'count'*) echo 1; exit 0 ;;
+ 'search-tags'*) echo 'errors'; exit 0 ;;
+ 'search'*'--output=tags'*) echo 'errors'; exit 0 ;;
+ esac
- if ssh $SSH_CONTROL_ARGS -O check 0.1
- then
- echo ' Control socket is alive but something failed during data transmission.'
- exit $ev
- fi
+ if ssh $SSH_CONTROL_ARGS -O check 0.1
+ then
+ echo ' Control socket is alive but something failed during data transmission.'
+ exit $ev
+ fi
- echo " See`sed '1d;2d;s/.//;q' "$0"` for help."
+ echo " See`sed '1d;2d;s/.//;q' "$0"` for help."
Note the `0.1` in ssh command line. It is used to avoid any opportunistic
behaviour ssh might do; for example if control socket is not alive ssh