Re: [SLE] Can't run this script



* Duff Mckagan <mckagan@xxxxxxxxx> [10-16-06 14:24]:
As I am still learning, I haven't come across the usage of ampersand.
But that shall be soon. But thanks for the prior information. :)

man bash
search for "&"

metacharacter
A character that, when unquoted, separates words. One of
the following: | & ; ( ) < > space tab
control operator
A token that performs a control function. It is one of
the following symbols: || & && ; ;; ( ) | <newline>

Lists
A list is a sequence of one or more pipelines separated by
one of the operators ;, &, &&, or ││, and optionally terminated
by one of ;, &, or <newline>.

Of these list operators, && and ││ have equal precedence,
followed by ; and &, which have equal precedence.

A sequence of one or more newlines may appear in a list instead
of a semicolon to delimit commands.

If a command is terminated by the control operator &, the shell
executes the command in the background in a subshell. The shell
does not wait for the command to finish, and the return status
is 0. Commands separated by a ; are executed sequentially; the
shell waits for each command to terminate in turn. The return
status is the exit status of the last command executed.

The control operators && and ││ denote AND lists and OR lists,
respectively. An AND list has the form

command1 && command2

command2 is executed if, and only if, command1 returns an exit
status of zero.

An OR list has the form

command1 ││ command2

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 anywhere 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 number 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 following the redirection operator in the following
descriptions, unless otherwise noted, is subjected to brace
expansion, tilde expansion, parameter expansion, command
substitution, arithmetic expansion, quote removal, pathname
expansion, and word splitting. 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.

Bash handles several filenames specially when they are used in
redirections, as described in the following table:

/dev/fd/fd
If fd is a valid integer, file descriptor fd is
duplicated.
/dev/stdin
File descriptor 0 is duplicated.
/dev/stdout
File descriptor 1 is duplicated.
/dev/stderr
File descriptor 2 is duplicated.
/dev/tcp/host/port
If host is a valid hostname or Internet address,
and port is an integer port number or ser‐ vice
name, bash attempts to open a TCP connection to
the corresponding socket.
/dev/udp/host/port
If host is a valid hostname or Internet address,
and port is an integer port number or ser‐ vice
name, bash attempts to open a UDP connection to
the corresponding socket.

A failure to open or create a file causes the redirection to
fail.

Redirections using file descriptors greater than 9 should be
used with care, as they may conflict with file descriptors the
shell uses internally.


and more......

--
Patrick Shanahan Registered Linux User #207535
http://wahoo.no-ip.org @ http://counter.li.org
HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2

--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-faq@xxxxxxxx



Relevant Pages

  • Re: interpreting a unix command I
    ... The shell — I will assume Bash 4.1 — is going to parse that into several ... expect from a given command line). ... the process's standard input, ... It's a point important enough to repeat: The redirection is handled ...
    (comp.unix.shell)
  • Re: whats wrong with this
    ... under bash? ... It worked but why (besides making the redirections the suffix)? ... redirection can only precede a simple command. ...
    (comp.unix.shell)
  • Re: [opensuse] saving boot-time console output
    ... # Set I/O of this script and its childs to console ... not specify a file descriptor open for input, ... a redirection error occurs. ... standard output is used. ...
    (SuSE)
  • RE: VBA routine (101)
    ... Directory command is implementing two switches “/s” to include files in all ... the command and switches as follows: CMD, DIR, Redirects> and Pipes | ... When you use a redirection symbol to send dir output to a file or a pipe ... > Writes the command output to a file or a device, such as a printer, instead of the Command Prompt window. ...
    (microsoft.public.excel.programming)
  • Re: VBA routine (101)
    ... DIR run the Directory command on ?C:\Ajay? ... The dos window closed upon execution, ... >probably is a slash command for the ?CMD? ... >When you use a redirection symbol to send dir output to a file or a pipe ...
    (microsoft.public.excel.programming)