Please use ***[code][/code] tags
*** around your code and data, to preserve formatting and to improve readability. Please do not
use quote tags, bolding, colors, or other fancy formatting.
Also, please don't print your entire prompt line when it's not needed. It makes your code more confusing to read. Limit your post to only things that are important for the conversation.
2. why shell is showing > symbol after cat test_4 << test_3 !
Because the shell considers the command to be an unfinished multi-line here document, it prints your PS2 prompt and waits for further input from you.
$ cat > f_1
hey ya , i am 305
$ cat < f_1 > f_2
command simply copies stdin
(or the contents of files) to stdout
, like a pipe connecting two sources.
The command "cat > f_1
" will redirect anything it receives to file f_1
, but since there are no input filenames or "<
" redirects given, the input can only come directly from you. Did you type "hey ya , i am 305
" yourself after the command? Because that's the only way it would show up normally. Generally running cat
with no input means that it will just sit there waiting for some (until it's killed or receives a ctrl+D EOF signal). If you type something and hit enter
, it will be redirected directly into the file.
"cat < f_1 > f_2
" simply copies the current contents of f_1
If you run "cat < f_1
", with no output file, then the contents of file f_1
are printed directly to your terminal, the default stdout