diff --git a/home/bashrc b/home/bashrc index d31019f..327f8cb 100644 --- a/home/bashrc +++ b/home/bashrc @@ -33,14 +33,14 @@ _temporary_scope_() { # this doesn't work for all scripts at the moment, but ADDPATH "$HOME/sh" -( - # combine everything matching "YES_BASH" in ~/sh/ into ~/.sh-bash. - # unlike zsh, we do not check the sha1sum of the output. - cd ~/sh \ - && printf '%s\n' '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \ - | cat - $(grep -lF YES_BASH -- $(find ~/sh/ -maxdepth 1 -type f '!' -name '*.bak')) \ - > ~/.sh-bash -) +# combine everything matching "YES_BASH" in ~/sh/ into ~/.sh-bash. +# unlike zsh, we do not check the sha1sum of the output. + (: \ + && cd ~/sh \ + && printf '%s\n' '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \ + | cat - > ~/.sh-bash \ + $(grep -lF YES_BASH -- $(find ~/sh/ -maxdepth 1 -type f '!' -name '*.bak')) \ + ;) dummy() { :; } ### @- return 0, ignoring arguments. preload=dummy diff --git a/home/zshrc b/home/zshrc index 679a74d..74ea21c 100644 --- a/home/zshrc +++ b/home/zshrc @@ -58,22 +58,23 @@ autoload edit-command-line autoload history-search-end zmodload zsh/mathfunc -function { - local a= b= - - # combine everything matching "YES_ZSH" in ~/sh/ into ~/.sh, - # but only recompile the output if the sha1sum has changed. - [ -s ~/.sh.sha1 ] && read -r b _ < ~/.sh.sha1 - ( cd ~/sh \ +# combine everything matching "YES_ZSH" in ~/sh/ into ~/.sh, +# but only recompile the output if the sha1sum has changed. +function + {: \ + && local a= b= \ + && { [ ! -s ~/.sh.sha1 ] || read -r b _ < ~/.sh.sha1 ;} \ + && (: \ + && cd ~/sh \ && print -l '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \ | cat - $(grep -lF YES_ZSH -- *~*.bak(.)) \ | tee ~/.sh \ - ) | sha1sum - \ - | tee ~/.sh.sha1 \ - | read -r a _ - - [ "$a" = "$b" ] && touch ~/.sh.zwc || zrecompile -p ~/.sh -} + ;) \ + | sha1sum - \ + | tee ~/.sh.sha1 \ + | read -r a _ \ + && { [ "$a" = "$b" ] && touch ~/.sh.zwc || zrecompile -p ~/.sh ;} \ + ;} dummy() : ### @- return 0, ignoring arguments. preload=dummy