Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 25 Oct 2014, 20:48
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
What's the difference in these two lines of code?
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: 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

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: 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
View user's profile Send_private_message 
matiasbatero


Joined: 11 Oct 2012
Posts: 60
Location: Mar del Plata, Argentina

PostPosted: 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
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3347
Location: Ontario

PostPosted: 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
View user's profile Send_private_message 
postfs1


Joined: 27 Mar 2010
Posts: 831

PostPosted: 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
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: 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
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: 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. Laughing

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0569s ][ Queries: 12 (0.0038s) ][ GZIP on ]