LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 06-05-2014, 08:59 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Rep: Reputation: 46
cp 8.19: running it in the background, does it show the errors on the foreground?


Hi: If I do
Code:
cp -r dir_A dir_B &
. Do I see the errors (stderr) on the screen (foreground)?
 
Old 06-05-2014, 09:10 PM   #2
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 271

Rep: Reputation: 63
Quote:
Originally Posted by stf92 View Post
Hi: If I do
Code:
cp -r dir_A dir_B &
. Do I see the errors (stderr) on the screen (foreground)?
Do you?

Why don't you cause an error when running the command and then you will see if the errors appear on the screen.
 
1 members found this post helpful.
Old 06-05-2014, 10:02 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by stf92 View Post
Hi: If I do
Code:
cp -r dir_A dir_B &
. Shall I see the errors (stderr) on the screen (foreground)?
[Edited by the author]
 
Old 06-05-2014, 10:19 PM   #4
jprzybylski
Member
 
Registered: Apr 2011
Location: Canada
Distribution: Slackware
Posts: 98

Rep: Reputation: 23
Quote:
Originally Posted by stf92 View Post
Hi: If I do
Code:
cp -r dir_A dir_B &
. Do I see the errors (stderr) on the screen (foreground)?
Yes, you will. To test, try something like this:
Code:
{ sleep 2; cp -r test.file imaginary/directory/that/does/not/exist; } &
This will spit an error in 2 seconds, despite being in the background.
 
Old 06-05-2014, 11:09 PM   #5
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 271

Rep: Reputation: 63
@stf92 - In case you didn't know this ... If you don't want the errors to go to the screen and you're using bash you can redirect them by modifying the example jprzybylski gave to ...

Code:
{ sleep 2; cp -r test.file imaginary/directory/that/does/not/exist 2> /tmp/errorlog.txt; } &
File descriptor '2' is the stderr you mentioned in your post.

If you use the man page for bash and search for REDIRECTION you'll find more information.
 
Old 06-05-2014, 11:09 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by TracyTiger View Post
Do you?

Why don't you cause an error when running the command and then you will see if the errors appear on the screen.
I already did it via
Code:
cp -r dir_A dir_B 2>&1 | less
I made a fool of myself.My intention was to get rid of the errors. Thank you TracyTiger.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Questions about background/foreground running processes Vexe Linux - General 7 03-06-2013 08:24 AM
Foreground vs Background gothrog Linux - General 3 07-08-2011 10:13 AM
Foreground and Background program switching isolvesystems Linux - Newbie 2 10-03-2007 09:30 AM
Background and Foreground Datamike Linux - Software 2 01-20-2006 04:20 PM
tty background/foreground color neo77777 Linux - General 10 08-18-2002 03:53 PM


All times are GMT -5. The time now is 03:44 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration