making unique file names

coverturtle coverturtle at gmail.com
Mon Apr 6 21:26:50 MST 2015


sudo apt-get update >file 2>&1

to get the errors coincident with the standard output
the following page is well-written and fairly clear:

http://www.tldp.org/LDP/abs/html/io-redirection.html

On 04/07/2015 12:10 AM, Michael Havens wrote:
> I am writing someone a letter. He has script that runs apt-get 
> update/grade in one swoop. Something happened once and he needed to 
> see what files had upgraded but because nothing print to screen he had 
> no idea which files did. Could someone tell me if I am telling it 
> correctly? In the unfinished paragraph I am unsure how to finish it. 
> What I want to do is prepend 'file' with the date. How is it done?
> Here is the letter:
>
> you know wiz, you might want to make your script print the output of 
> update/upgrade to a file in case something like this happens again and 
> you need to see what it did. You do this by typing:
>
>
>    sudo apt-get update > file
>
>    sudo apt-get upgrade >> file
>
>
> If you want it to print any errors that may have scrolled by to the 
> file you'll have to pre-pend the carrots with '&2' to make it look 
> like this:
>
>
>    sudo apt-get update &2> file
>
> and
>
>    sudo apt-get upgrade &2>> file
>
>
> I'm pretty sure that is how it is done at least. I wouldn't worry 
> about making 'file' unique for each time you run it as you'll never 
> look at it unless there is a problem. If you really want to do that
>
> :-)~MIKE~(-:
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20150407/105bf08c/attachment.html>


More information about the PLUG-discuss mailing list