Why is that some commands require the echo statement but others can simply be written without:
#!/bin/bash
aptitude upgrade
echo "mysql-server-5.1 mysql-server/root_password password $DB_PASSWORD" | debconf-set-selections
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The commands that feed on stdin for some input to process, are usually fed by echo command. Echo dumps the string provided to it on stdout, which in turn is duplicated on stdin using the pipe “|”.
So for the commands which does not require input from stdin or uses some other method of input to process can be written without echo command.