<div dir="ltr">Okay, I wasn't sure if that would work or not since I was running the internal script as a different user. Thanks.<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 21, 2013 at 10:11 AM, Reindl Harald <span dir="ltr"><<a href="mailto:h.reindl@thelounge.net" target="_blank">h.reindl@thelounge.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Am <a href="tel:21.08.2013%2016" value="+12108201316">21.08.2013 16</a>:04, schrieb Mark Haney:<br>
<div class="im">> I've got a bash script that has two parts.<br>
><br>
> 1. runs a script as a different user (using su <username> -c <script>)<br>
> 2. when that part finishes, the script does a copy of the files created to another directory<br>
><br>
> I want to log the output of the entire script into one file. I.e.:<br>
><br>
> internal script>external script> logfile<br>
><br>
> What's the best way to do this? I can clarify, I hope, I've edited this a dozen times to get what I want in as<br>
> clear a message as possible<br>
<br>
</div>why do you think you need to care about the internal called one?<br>
you call wathever and say "redirect my output", that belongs to<br>
*anything* called by this script with the only eception of stderr<br>
<br>
command 2>> logfile.txt >> logfile.txt<br>
<br>
>> is "do not make the file empty, add your output at the end"<br>
> would empty any existing file before<br>
___________________________________________<br>
<br>
[harry@rh:~/Desktop/test]$ cat script1.sh<br>
#!/usr/bin/bash<br>
echo "OUTPUT SCRIPT 1"<br>
bash ./script2.sh<br>
<br>
[harry@rh:~/Desktop/test]$ cat script2.sh<br>
#!/usr/bin/bash<br>
echo "OUTPUT SCRIPT 2"<br>
<br>
[harry@rh:~/Desktop/test]$ ./script1.sh<br>
OUTPUT SCRIPT 1<br>
OUTPUT SCRIPT 2<br>
<br>
[harry@rh:~/Desktop/test]$ ./script1.sh > output.txt<br>
<br>
[harry@rh:~/Desktop/test]$ cat output.txt<br>
OUTPUT SCRIPT 1<br>
OUTPUT SCRIPT 2<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Caesar si viveret, ad remum dareris.<br><br>Mark Haney<br>Software Developer/Consultant<br><a href="mailto:mark.haney@gmail.com" target="_blank">mark.haney@gmail.com</a>
</div>