Ask HN: What to use instead of Bash / Sh for scripting?
101–106 of 106 posts
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#102Re: Ask HN: What to use instead of Bash / Sh for scripting?
#103Re: Ask HN: What to use instead of Bash / Sh for scripting?
#104Re: Ask HN: What to use instead of Bash / Sh for scripting?
#105Tcl. As with other shells, the scripting model is based on commands and substitutions, but in Tcl substitution is more sane because a substitution is never reparsed and reinterpreted. Tcl was designed to provide a uniform scripting environment that could be extended into any problem domain. In this sense, is specifically intended as a generalization of the concept of a shell beyond interactive use by a logged-in user…
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#106A configuration management system may have you write e.g. YAML with Jinja2 so that you don't reinvent the idempotent wheel. It's really easy to write dangerous shell scripts ("${@}" vs ${@} for example) and also easy to write dangerous Python scripts (cmd="{}; {}"). Sarge is one way to use subprocess in Python. https://sarge.readthedocs.io/en/latest/ If you're doing installation and configuration, the most team-maint…
ansible-molecule is a test runner for Ansible playbooks that can create VMs or containers on local or remote resources.
You can definitely just call shell scripts from Ansible, but the (parallel) script output is only logged after the script returns a return code unless you pipe the script output somewhere and tail that .
> manual verification of `set +xev` output isn't an automated assertion.
From "Bash Error Handling" https://news.ycombinator.com/item?id=24745833 : you can display the line number in `set -x` output by setting $PS4:
export PS4='+(${BASH_SOURCE}:${LINENO}) '
set -x
But that's no substitute for automated tests and a test runner that produces e.g. TAP output from test runner results: http://testanything.org/producers.html#shell