I would like to write a bash script the prints the commands. But for readability purposes, I do not want it to print the echo commands. Unfortunately, I cannot find the correct settings for my bash script to achieve this. I need help?
#!/bin/bash
# Makes the bash script to print out every command before it is executed
set -v
echo "Cleaning test database"
RAILS_ENV=test bundle exec rake db:drop
echo "************************************************************"
echo ""
echo "Setting up the test database"
RAILS_ENV=test bundle exec rake db:setup
echo "************************************************************"
echo ""
The output looks like:
echo "Cleaning test database"
Cleaning test database
RAILS_ENV=test bundle exec rake db:drop
echo "************************************************************"
************************************************************
echo ""
echo "Setting up the test database"
Setting up the test database
RAILS_ENV=test bundle exec rake db:setup
As you can see it prints out all the commands including the echo command, which I do not want to see.
| grep -v "echo "makeechoes each command by default as it executes it, unless you prefix the command with @.