Carlo Sogono wrote:
O Plameras wrote:
Carlo Sogono wrote:
True, actually not even man bash. If you execute the command you'll most likely get an error complaining about the file 1, create a file 1 and re-execute it and by using the magic commands ls and cat he'd figure it out without needing the man pages.
This is not going to produce errors because,

$cat 1>m1

means concatenate "std.input" into filename "m1".

1 is actually stdout as mentioned in my previous message. You're redirecting to m1 what cat is outputting to the screen and not what your entering to the keyboard so


Yes, 1 == std.out, but note that,

$cat 1>m1 is another way of writing

$cat >m1

which means

concatenate "std.input" into filename "m1".

In the context of $cat 1>m1, the output is specified
std.out == 1,  but at the same time is re-directed to filename "m1'.
In the same context, the input is not specified, so the
default is used which is "std.input" == 0. That's why
$cat 1>m1

means concatenate "std.input" into filename "m1".

$ echo testme 1>m1

will put testme to m1, something that didn't come from stdin. Bash by default sends to stdout whatever it reads from stdin so doing

$ echo testme >&0

just prints it to the screen anyway.


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to