.config/fish/functions/touch-script.fish
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function touch-script --description 'Creates an executable shell script boilerplate file'
if test (count $argv) -eq 0
set -f func_name "$(basename $(status --current-filename) .fish)"
echo "usage: $func_name [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
|