Cat/File Descriptor Question

Thread Tools Search this Thread
# 1  
Old 03-06-2017
Cat/File Descriptor Question

For the command below, I need to understand what exactly the command does and provide an examples for which the output will be saved to file save2... From my understanding, if the file provides an error in the first half of the pipe, it'll save to save1 and will never give an error to save to save2. I'm just confused as to what exactly would cause it to save anything to save2.

2. Relevant commands, code, scripts, algorithms:
cat 2>save1 0<memo | sort 2>save2 1>letter

Any help with this or if anyone can provide a tutorial that goes into examples using a combination of cat, pipes and file descriptors I would really appreciate it!

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number:

Texas State University, San Marcos, TX, USA, Professor Quijun Gu, CS 4350

Moderator's Comments:
Mod Comment please use next time the full template, even if you believe to not enter in the orthodox form try your best, and dont forget to use for all code and data code tags , thanks

Last edited by vbe; 03-06-2017 at 03:59 AM..
# 2  
Old 03-06-2017
Assuming that the file memo is a non-empty text file containing:

and that there is no file named none, what output would you expect to get in the files named save1, save2, and letter if you were to run the pipeline:
cat memo none 2>save1 | sort - none 2>save2 > letter

? If you then actually run this pipeline with the input files set up as described above, did you get the output you expected? If not, what did you get and what did you expect to get?
# 3  
Old 03-06-2017
I would start like I would in any human language: analyse the given phrase and see it composition, then would test the bits/blocks I understand.( or not...).
- how many processes have we here?

If more than one
what does the first - Can I test and se what it does
What should do the second - can I test? If not what am I expecting it to produce, then get the code working and see if I am right if not, why?

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
cat question karlhungus Shell Programming and Scripting 10 02-07-2012 09:26 AM
Question regarding Cat saggiboy10 UNIX for Dummies Questions & Answers 4 12-28-2011 09:05 AM
Help with File Descriptor in a While loop Subu1987 Shell Programming and Scripting 2 10-18-2011 05:07 PM
cat question shehzad_m Shell Programming and Scripting 4 07-18-2011 04:15 PM
Easy cat question Drenhead Shell Programming and Scripting 3 05-05-2011 03:55 PM
Question about cat and echo jamesapp OS X (Apple) 1 10-08-2009 05:33 PM
Question regarding cat command asirohi Shell Programming and Scripting 11 08-06-2009 04:28 PM
File Descriptor siba.s.nayak UNIX for Dummies Questions & Answers 1 12-12-2008 06:10 AM
File Descriptor rimser9 Shell Programming and Scripting 3 08-14-2008 07:34 AM
A small question about file descriptor mlhazan Programming 5 08-10-2008 06:51 PM
question about cat in script naamas03 Shell Programming and Scripting 6 08-06-2008 06:35 AM
strange cat question. sanchopansa Shell Programming and Scripting 3 10-10-2006 02:39 PM
File descriptor constant vino Programming 4 05-18-2005 02:18 AM
File Descriptor Help rahulrathod UNIX for Dummies Questions & Answers 3 10-14-2004 06:08 AM
file activity (open/closed) file descriptor info using KORN shell scripting Gary Dunn UNIX for Dummies Questions & Answers 3 06-07-2004 02:54 PM