You are not logged in.
name it something like shell_template.sh
invoke it using any naming argument.
./shell_template.sh NAME
NAME being whatever you want to name the outgoing file.
It will then create and enter that file for editing
#!/usr/bin/env bash
set -euo pipefail
set -x
export EDITOR=geany
set +u
FILE=$1
set -u
for FILE in "$@"
do
printf "#!/usr/bin/env bash\n" > $FILE
chmod 755 $FILE
done;
$EDITOR $FILE
some modifications needed.
set up defaults for local shell scripts, i keep mine in .local/bin
$EDITOR = your default editor (or export geany as per script).
Uses unofficial bash strict mode, http://redsymbol.net/articles/unofficia … rict-mode/
edited: when using bash strict mode the script failed, re wrote the script so should work ok now.On a bit of a steep learning curve here, not sure if im understanding this well enough.
edit: made it executable
Last edited by clusterF (2019-12-14 02:45:07)
Offline
Does the script have to remain after starting the editor?
Maybe
exec $EDITOR $FILE
would be better.
or use 'bl-text-editor' instead of 'EDITOR'?
exec bl-text-editor $FILE
Offline
Does the script have to remain after starting the editor?
Maybe
exec $EDITOR $FILE
would be better.
or use 'bl-text-editor' instead of 'EDITOR'?
exec bl-text-editor $FILE
Im not sure about that behavior, the script seems to save the file in place with no option to save it manually in geany. Probably something im missing/dont understand and my hacky scripting.
Im in voidlinux but one could use bl-text-editor instead for sure.
Last edited by clusterF (2019-12-15 04:31:31)
Offline