diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-09-20 14:24:04 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-09-20 14:24:04 +0200 |
commit | 5c8ab2c259e8439a6713645bd3939a30ea63cf21 (patch) | |
tree | a428ccd8dacef99b7985e03c43aaa43fc3001c35 /skripti | |
parent | davčna.py (diff) | |
download | r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.tar r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.tar.gz r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.tar.bz2 r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.tar.lz r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.tar.xz r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.tar.zst r-5c8ab2c259e8439a6713645bd3939a30ea63cf21.zip |
Diffstat (limited to 'skripti')
-rwxr-xr-x | skripti/sponge_only_on_success.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/skripti/sponge_only_on_success.sh b/skripti/sponge_only_on_success.sh new file mode 100755 index 0000000..6f6f65b --- /dev/null +++ b/skripti/sponge_only_on_success.sh @@ -0,0 +1,14 @@ +#!/bin/bash +p=`rev <<<$0 | cut -d/ -f1 | rev` +t=`mktemp -p "" $p.XXX` +o=$1 +shift +$@ > $t +r=$? +if [ $r -eq 0 ] +then +cat $t > $o +else +echo called command $@ exited with nonzero $r >&2 +exit $r +fi |