Okay, I wasn't sure if that would work or not since I was running the
internal script as a different user.  Thanks.



On Wed, Aug 21, 2013 at 10:11 AM, Reindl Harald <h.rei...@thelounge.net>wrote:

>
>
> Am 21.08.2013 16:04, schrieb Mark Haney:
> > I've got a bash script that has two parts.
> >
> > 1. runs a script as a different user (using su <username> -c <script>)
> > 2. when that part finishes, the script does a copy of the files created
> to another directory
> >
> > I want to log the output of the entire script into one file.  I.e.:
> >
> > internal script>external script> logfile
> >
> > 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
> > clear a message as possible
>
> why do you think you need to care about the internal called one?
> you call wathever and say "redirect my output", that belongs to
> *anything* called by this script with the only eception of stderr
>
> command 2>> logfile.txt >> logfile.txt
>
> >> is "do not make the file empty, add your output at the end"
> > would empty any existing file before
> ___________________________________________
>
> [harry@rh:~/Desktop/test]$ cat script1.sh
> #!/usr/bin/bash
> echo "OUTPUT SCRIPT 1"
> bash ./script2.sh
>
> [harry@rh:~/Desktop/test]$ cat script2.sh
> #!/usr/bin/bash
> echo "OUTPUT SCRIPT 2"
>
> [harry@rh:~/Desktop/test]$ ./script1.sh
> OUTPUT SCRIPT 1
> OUTPUT SCRIPT 2
>
> [harry@rh:~/Desktop/test]$ ./script1.sh > output.txt
>
> [harry@rh:~/Desktop/test]$ cat output.txt
> OUTPUT SCRIPT 1
> OUTPUT SCRIPT 2
>
>


-- 
Caesar si viveret, ad remum dareris.

Mark Haney
Software Developer/Consultant
mark.ha...@gmail.com
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to