Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
graton
on Oct 27, 2022
|
parent
|
context
|
favorite
| on:
Shell script best practices, from a decade of scri...
Author mentions using xtrace aka `set -x`. If using xtrace I highly recommend doing:
export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}: '
This will then append the filename, function name, and line number to the command being executed. Can make it much easier to find where exactly something is happening when working with larger bash scripts.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: