DB_USER = 'db_user'
DB_PASS = 'db_pass'
DB_HOST = 'db_host'
DB = 'db'
function dbConnection() {
echo "$1" | mysql -u${DB_USER} -p${DB_PASS} -h${DB_HOST} ${DB} -N
}
Request you to ignore the actual values of the db variables. I wanted to understand the meaning of the above method. I have the following doubts:
- What is echo "$1" doing here?
- Why are we using the pipe operator?
- And what is the relation between the echo command and the mysql command?