bash script template #51
Labels
No labels
bug
documentation
duplicate
enhancement
help wanted
invalid
maintenance
obsolete
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
yestax/setup#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
bash scripts often have the same structure, could be great to have a template for that
shebang
set -euo pipefail
SCRIPT_DIR (independance of calling location)
usage function
arguments reading function
sections (constants, functions, ...)
To get user input a path:
INPUT="$(realpath "$1")"
To get absolute path of script:
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Solved by #90 may be enhanced in the future