Skip to content

A minimal bash script to print each command being run in a bash script

License

Notifications You must be signed in to change notification settings

lovey89/bash-command-printer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bash-command-printer

A minimal bash script to print each command being run in a bash script

Getting started

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

Hello world

examples/01_hello_world/hello_world

Variable expansion

examples/02_variable_expansion/variable_expansion

examples/03_command_substitution/command_substitution

Multiple commands on the same line

examples/04_multiple_commands/multiple_commands

examples/04_multiple_commands/multiple_commands_split

if statements

examples/05_if_statements/if_statements

Loops

examples/06_loops/while_loop

examples/06_loops/range_loop

Show for how long time a command runs

examples/07_long_running_commands/no_report

examples/07_long_running_commands/with_report

About

A minimal bash script to print each command being run in a bash script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages