Article View: alt.fan.holy-mother-megan
Article #9246Re: Dawno nie było...
From: Gophi - fan Meg
Date: Sun, 21 Apr 2002 09:50
Date: Sun, 21 Apr 2002 09:50
200 lines
10124 bytes
10124 bytes
On Sat, 20 Apr 2002, Puck wrote:
> > > > Pod DOS-em też to jest, tylko w prostszej implementacji.
> > > Mhm, nadal wszystko rozumiem :>
> > Używałeś kiedyś znaczków '>', '<' i '|'?
> W dosie? No zdaję sobię sprawe, co robią.
No to wyobraź sobie, że pod Linuksem to samo, tylko o wiele bardziej
zaawansowanie (np. rura może obsługiwać kilka komend jednocześnie tak,
że jedna czeka na reakcję drugiej). Dokładniejszy opis.
Pipelines
A pipeline is a sequence of one or more commands separated
by the character |. The format for a pipeline is:
[ ! ] command [ | command2 ... ]
The standard output of command is connected to the stan
dard input of command2. This connection is performed
before any redirections specified by the command (see
REDIRECTION below).
If the reserved word ! precedes a pipeline, the exit sta
tus of that pipeline is the logical NOT of the exit status
of the last command. Otherwise, the status of the
pipeline is the exit status of the last command. The
shell waits for all commands in the pipeline to terminate
before returning a value.
Each command in a pipeline is executed as a separate pro
cess (i.e., in a subshell).
REDIRECTION
Before a command is executed, its input and output may be
redirected using a special notation interpreted by the
shell. Redirection may also be used to open and close
files for the current shell execution environment. The
following redirection operators may precede or appear any
where within a simple command or may follow a command.
Redirections are processed in the order they appear, from
left to right.
In the following descriptions, if the file descriptor num
ber is omitted, and the first character of the redirection
operator is <, the redirection refers to the standard
input (file descriptor 0). If the first character of the
redirection operator is >, the redirection refers to the
standard output (file descriptor 1).
The word that follows the redirection operator in the fol
lowing descriptions is subjected to brace expansion, tilde
expansion, parameter expansion, command substitution,
arithmetic expansion, quote removal, and pathname expan
sion. If it expands to more than one word, bash reports
an error.
Note that the order of redirections is significant. For
example, the command
ls > dirlist 2>&1
directs both standard output and standard error to the
file dirlist, while the command
ls 2>&1 > dirlist
directs only the standard output to file dirlist, because
the standard error was duplicated as standard output
before the standard output was redirected to dirlist.
Redirecting Input
Redirection of input causes the file whose name results
from the expansion of word to be opened for reading on
file descriptor n, or the standard input (file descriptor
0) if n is not specified.
The general format for redirecting input is:
[n]<word
Redirecting Output
Redirection of output causes the file whose name results
from the expansion of word to be opened for writing on
file descriptor n, or the standard output (file descriptor
1) if n is not specified. If the file does not exist it
is created; if it does exist it is truncated to zero size.
The general format for redirecting output is:
[n]>word
If the redirection operator is >|, then the value of the
-C option to the set builtin command is not tested, and
file creation is attempted. (See also the description of
noclobber under Shell Variables above.)
Appending Redirected Output
Redirection of output in this fashion causes the file
whose name results from the expansion of word to be opened
for appending on file descriptor n, or the standard output
(file descriptor 1) if n is not specified. If the file
does not exist it is created.
The general format for appending output is:
[n]>>word
Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1)
and the standard error output (file descriptor 2) to be
redirected to the file whose name is the expansion of word
with this construct.
There are two formats for redirecting standard output and
standard error:
&>word
and
>&word
Of the two forms, the first is preferred. This is seman
tically equivalent to
>word 2>&1
Here Documents
This type of redirection instructs the shell to read input
from the current source until a line containing only word
(with no trailing blanks) is seen. All of the lines read
up to that point are then used as the standard input for a
command.
The format of here-documents is as follows:
<<[-]word
here-document
delimiter
No parameter expansion, command substitution, pathname
expansion, or arithmetic expansion is performed on word.
If any characters in word are quoted, the delimiter is the
result of quote removal on word, and the lines in the
here-document are not expanded. Otherwise, all lines of
the here-document are subjected to parameter expansion,
command substitution, and arithmetic expansion. In the
latter case, the pair \<newline> is ignored, and \ must be
used to quote the characters \, $, and `.
If the redirection operator is <<-, then all leading tab
characters are stripped from input lines and the line con
taining delimiter. This allows here-documents within
shell scripts to be indented in a natural fashion.
Duplicating File Descriptors
The redirection operator
[n]<&word
is used to duplicate input file descriptors. If word
expands to one or more digits, the file descriptor denoted
by n is made to be a copy of that file descriptor. If
word evaluates to -, file descriptor n is closed. If n is
not specified, the standard input (file descriptor 0) is
used.
The operator
[n]>&word
is used similarly to duplicate output file descriptors.
If n is not specified, the standard output (file descrip
tor 1) is used. As a special case, if n is omitted, and
word does not expand to one or more digits, the standard
output and standard error are redirected as described pre
viously.
Opening File Descriptors for Reading and Writing
The redirection operator
[n]<>word
causes the file whose name is the expansion of word to be
opened for both reading and writing on file descriptor n,
or as the standard input and standard output if n is not
specified. If the file does not exist, it is created.
> > > > DOS zamiast "Broken pipe" wyświetlał coś w stylu "Intermediate
> > > > command error during pipe" czy coś takiego, nie pamiętam.
> > > Dos wyświetlał: '...dysk nie jest już być prawidłowy...' ;)
> > A to swoją drogą. :> OE wstawia: "Użytkownik
> > (...) w wiadomości napisał:msgid...". :D
> Tak, ten colon jest co najmniej głupi.
Chodziło o to, że w oryginale jest wrote news:mid. :D
--
Gophi * LB#265791 * Mastah Fan of our mother Megan
Phone#: +48503963441 * bash$ [(){ [|[&};](){ [;};]
Sprzedam kafejkę internetową w malowniczej okolicy
(Człuchów) w cenie 30kPLN. Info: priv albo telefon
Technical Details
Message-ID:
<Gophi.afhmm.3694.1@news.afhmm.gophi.net>Path:
mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!newsfeeds.belnet.be!news.belnet.be!fr.clara.net!heighliner.fr.clara.net!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mailReferences:
<Gophi.afh.605.1@news.afh.gophi.net> <16032002.Sat.93410644166@pucked.blade.net> <Gophi.afh.1267.1@news.afh.gophi.net> <23032002.Sat.9511270463@pucked.blade.net> <Gophi.afh.1812.1@news.afh.gophi.net> <30032002.Sat.31925266422@pucked.blade.net> <Gophi.afh.2515.1@news.afh.gophi.net> <11042002.Thu.82810552213@pucked.blade.net> <Gophi.afhmm.2730.1@news.afhmm.gophi.net> <16042002.Tue.8849950448@pucked.blade.net> <Gophi.afhmm.3383.1@news.afhmm.gophi.net> <20042002.Sat.91015605934@pucked.blade.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!newsfeeds.belnet.be!news.belnet.be!fr.clara.net!heighliner.fr.clara.net!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mail From: Gophi - fan Meg <fra...@skrzynka.pl> Newsgroups: alt.fan.holy-mother-megan Subject: Re: Dawno nie było... Date: Sun, 21 Apr 2002 11:50:19 +0200 Organization: Fanklub Meganki Lines: 200 Message-ID: <Gophi.afhmm.3694.1@news.afhmm.gophi.net> References: <Gophi.afh.605.1@news.afh.gophi.net> <16032002.Sat.93410644166@pucked.blade.net> <Gophi.afh.1267.1@news.afh.gophi.net> <23032002.Sat.9511270463@pucked.blade.net> <Gophi.afh.1812.1@news.afh.gophi.net> <30032002.Sat.31925266422@pucked.blade.net> <Gophi.afh.2515.1@news.afh.gophi.net> <11042002.Thu.82810552213@pucked.blade.net> <Gophi.afhmm.2730.1@news.afhmm.gophi.net> <16042002.Tue.8849950448@pucked.blade.net> <Gophi.afhmm.3383.1@news.afhmm.gophi.net> <20042002.Sat.91015605934@pucked.blade.net> NNTP-Posting-Host: wysocki.lodz.pdi.net Mime-Version: 1.0 X-Trace: news.tpi.pl 1019472441 2863 195.116.163.58 (22 Apr 2002 10:47:21 GMT) X-Complaints-To: use...@tpi.pl NNTP-Posting-Date: Mon, 22 Apr 2002 10:47:21 +0000 (UTC) In-Reply-To: <20042002.Sat.91015605934@pucked.blade.net> X-Posting-Agent: ShellPoster v1.2 (20-04-2002) Copyright (C) 2002 Adam "Gophi" Wysocki * http://wysocki.lodz.pdi.net/~adam/shellposter/ X-Geek-Code: My geekcode will be available soon. :) X-Processed-1: This message was processed on my localhost and converted X-Processed-2: from nnrp-spool to Hamster with my open-source converter. X-Processed-3: Send beer, t-shirts, pizza and bug-reports directly to me. X-Newsreader: Pine 4.10 / Red Hat Linux 6.1 / Kernel 2.2.12-20 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit