#!/usr/bin/env bash # logrun.sh : run a command with its output in ~/opence-build/logs/.log # and its exit status appended as the last line (for long runs started from Windows). name="$1"; shift log="$HOME/opence-build/logs/$name.log" mkdir -p "$(dirname "$log")" "$@" > "$log" 2>&1 rc=$? echo "exit=$rc" >> "$log" exit $rc