| Author |
Message |
RSH

Joined: 05 Sep 2011 Posts: 1564 Location: Germany
|
Posted: Sat 12 Jan 2013, 00:32 Post subject:
What's the difference in these two lines of code? |
|
Hi.
I hope anyone can tell me what is the difference (in functionality) between the two following code lines:
| Code: | | cp -af /root/puppy-reference /tmp/root/ |
| Code: | | cp -af /root/puppy-reference /tmp/root/ 2>/dev/null |
Thanks
RSH
_________________ Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Sat 12 Jan 2013, 01:09 Post subject:
|
|
Hi RSH; 2> redirects the error output of the command.
/dev/null is a "black hole" that swallows whatever is sent to it.
Code from my AppPkg mount file:
| Code: | | Etc=`find etc/* 2> /dev/null` |
If there`s no etc dir. in the current dir., there`s no error output in a VT.
|
|
Back to top
|
|
 |
matiasbatero

Joined: 11 Oct 2012 Posts: 13 Location: Mar del Plata, Argentina
|
Posted: Sat 12 Jan 2013, 12:39 Post subject:
|
|
2> /dev/null is very usefull when you wants to make a silent scripts.
Adding 2> /dev/null, you send the ouput error to the trash, and nothing is printed on your screen.
|
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 2465 Location: Ontario
|
Posted: Sat 12 Jan 2013, 14:57 Post subject:
|
|
| Code: |
cp -af /root/puppy-reference /tmp/root/ 2>/tmp/error$$ |
I have found that funnelling the error
message to a file in /tmp is useful in studying whether
my partition is filled up. I do a 'grep' of /tmp/error$$
to see if there is text 'no space left' or whatever that error message is.
I used that technique in my pet packages 'Extract-pet' and 'Extract-debian'
to warn the user that there is not enough disk space to do extraction.
It works well with 'mv' command or 'mv -i' command I believe.
____________________________________________________
|
|
Back to top
|
|
 |
postfs1

Joined: 27 Mar 2010 Posts: 831
|
Posted: Sat 12 Jan 2013, 15:08 Post subject:
|
|
Maybe: request for a third-party programmatic option.
_________________
- I don't know why laboratories are named a hospitals.
- The alive personage is like a tea bag with granules of unknown density inside, at that one the packet was made of organic material and was placed in the evaporated liquid or liquid.
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Sat 12 Jan 2013, 23:31 Post subject:
|
|
I`ve always thought that copy and move should check target free space.
What`s the point in even beginning to copy if there`s not enough space?
Remembering the days of copying to a floppy only to have it fail at the end
because the darn thing has enough bad sectors that it won`t hold the data.
|
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 1564 Location: Germany
|
Posted: Sun 13 Jan 2013, 00:52 Post subject:
|
|
Hi.
Thanks to all for clearing this. I was a bit afraid to have left something out that would be necessary - in all of my programs.
RSH
_________________ Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
|
|
Back to top
|
|
 |
|