Add misc. useful functions from bash
x1phosura x1phosura@x1phosura.zone
Fri, 11 Oct 2024 01:27:09 -0700
2 files changed,
24 insertions(+),
0 deletions(-)
A
.config/fish/functions/sync-src-to-dest.fish
@@ -0,0 +1,11 @@
+function sync-src-to-dest --description 'Creates an executable shell script boilerplate file' + if test (count $argv) -ne 2 + echo "A useful rsync helper, semi-unsafe if used thoughtlessly" + echo "usage: sync-src-to-dest [src-dir/] [dest-dir/]" + return 1 + end + + # for syncing to Android phone + #rsync -rlgo -vhcz -e ssh --stats --progress --delete --force $argv[1] $argv[2] + rsync -avhcz -e ssh --stats --progress --delete --force $argv[1] $argv[2] +end
A
.config/fish/functions/touch-script.fish
@@ -0,0 +1,13 @@
+function touch-script --description 'Creates an executable shell script boilerplate file' + if test (count $argv) -eq 0 + echo "usage: $argv[0] [path(s) to one or more script file(s) to init...]" + return 1 + end + + for file in $argv + printf \ + "#!/bin/sh\n\n# script body here...\n" > $file \ + > $file + chmod +x $file + end +end