Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The "echo" parts are kind of unnecessary. You can run the programs plain without the backticks, but group them inside a set of parenthesis and then pipe the output of the parenthesis to "tee"
The && only waits for the preceding command to finish and if the return value is 0, then proceeds to the next command.
The pipe ( | ) is a form of I/O redirection.
Code:
program1 ARGS | program2 ARGS
The above example command actually takes the output obtained from program1 and pipes it into program2. Basically, output of program1 becomes input for program2.
Code:
program1 ARGS > textfile.log
For this one, the output of program1 will be redirected to the regular file textfile.log. In other words, if program1 normally outputs messages on the standard output (your terminal screen), then this output will now be placed in the regular file after the ">".
The "| tee" in your command replaces the ">", and the && only look at the return values from the echo's. So, you need to use a single echo or multiple echo's on different lines and each with their respective tee's or >
Last edited by aragorn2101; 06-07-2016 at 07:50 AM.
Isn't that supposed to be between brackets? It doesn't work with { } But it does with brackets. I suppose I could also simply redirect it to /var/log/whatever and then simply cat that /var/log/whatever. Thought of it afterwards.
But I guess I'm going back to turbocapitalist's answer. So that's quite logical, indeed.
But how can I append the output using tee? So displaying stdout, but also appending it to a certain file?
But how can I append the output using tee? So displaying stdout, but also appending it to a certain file?
You can append with -a, according to the manual page for "tee". There's also "tee --help" but that gives about the same information. If you leave off the -a it will overwrite the file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.