-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript_template.sh
More file actions
executable file
·37 lines (35 loc) · 910 Bytes
/
script_template.sh
File metadata and controls
executable file
·37 lines (35 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh -e
#
# This line tells what I do
#
# This paragraph provides more details if necessary
#
# USE:
# Show calling conventions here
#
# NOTES:
# Note any assumptions, preconditions, side effects
#
# EXAMPLES:
# Provide example use here
#
# EXIT CODES:
# Describe all custom exit codes here
#
# CAVEATS:
# Any warnings for script use?
#
THIS_SCRIPT_DIR=$(dirname $(readlink -f "${0}"))
(
cd ${THIS_SCRIPT_DIR}
# Do stuff in the dir the script lives in without changing pwd
# Now that we know our dir, constructing relative paths is easy
# NOTE: the parens isolate the change by shifting into a subshell
)
# You could do directory insensitive things here, but have a good
# reason for not just putting them into a single paren block
(
cd ${THIS_SCRIPT_DIR}/..
# Do some stuff in my parent dir without changing pwd
# Each directory change should be scoped with ( )
)