bash script template #51

Closed
opened 2026-04-22 15:34:26 +02:00 by yestax · 3 comments
Owner

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, ...)

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, ...)
Author
Owner

To get user input a path:
INPUT="$(realpath "$1")"

To get user input a path: INPUT="$(realpath "$1")"
Author
Owner

To get absolute path of script:
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

To get absolute path of script: SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
yestax added this to the Setup v1.3.X milestone 2026-04-30 18:53:46 +02:00
Author
Owner

Solved by #90 may be enhanced in the future

Solved by #90 may be enhanced in the future
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yestax/setup#51
No description provided.