From e659f1af3d3ef0da6161bbf373ad815324e3184d Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sat, 24 Feb 2024 13:38:43 -0500 Subject: [PATCH] Histfile fallback --- fake_home/.zshrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 6832ceb..4b8752a 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -132,10 +132,13 @@ function merge-hist { } function sync-history { - scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile" + if ! scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile"; then + scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' + return + fi merge-hist "$HOME/.histfile" "/tmp/.histfile" > "/tmp/$(whoami).histfile" mv "/tmp/$(whoami).histfile" "$HOME/.histfile" - scp -P 11275 "$HOME/.histfile" "/tmp/$(whoami).histfile" + scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' } function load-extensions {