A minimal bash script to print each command being run in a bash script
Getting started with the command printer is easy! Just source the
command-printer
file and run the activate_command_printer
function. That's
it!
#!/usr/bin/env bash
# To activate the command printer
. command-printer
activate_command_printer
# Your script here
echo "Hello world"
You can also choose to activate the command printer later in the script if you don't care about printing e.g. setup commands:
#!/usr/bin/env bash
# To activate the command printer
. command-printer
# Your setup code
activate_command_printer
# Your script here
echo "Hello world"
examples/01_hello_world/hello_world
examples/02_variable_expansion/variable_expansion
examples/03_command_substitution/command_substitution
examples/04_multiple_commands/multiple_commands
examples/04_multiple_commands/multiple_commands_split
examples/05_if_statements/if_statements