Re: [SLE] Can't run this script
On 10/16/06, Falcon, George
IIRC, SuSE doesn't include ksh as one of its standard offerings... which is one reason I went with Fedora for a recent project here. That was easier and quicker for me than installing ksh separately to SuSE.
As for the script, put an ampersand immediately after the greater than symbol.
I use " 2>&1 " to redirect both standard output and standard error to another file, as in
gzip /opt/Novadigm/gsd/scripts/backup/*.tar 2>&1 | tee -a /opt/Novadigm/gsd/log/$logfile
Yeah..this script seems to work. 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. :) Also people have been telling me on this same thread that ksh does exist for SuSE and its also there in the CDs, but I gave it a shot and was not able to find them. I also have Slackware 10.2 installed on this machine and its got ksh. :)
-----Original Message----- From: Duff Mckagan [mailto:mckagan@gmail.com] Sent: Sunday, October 15, 2006 7:46 AM To: SLE Subject: SPAM: [SLE] Can't run this script
I am learning Shell Programming ..but the book I have is "Unix Shell Programming" and I know there are gonna be some differences, but in this case, Error Redirection is not working as wanted...
Here's the script.
i=a echo `i` 2>> err
Can somebody point out the error? ..if there's any ..lol
Also, I want to install "ksh" on SuSE. Just wanted to ask whether it is provided with the default installation..or is it present in the Cds..or do the Repositories offer them? I had added non-free reps in my SuSE Installation Sources, but I don't think I was able to find "ksh" in the list.
PS: I have also included Packman.
-- http://mckagan.googlepages.com ==================== This email/fax message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of this email/fax is prohibited. If you are not the intended recipient, please destroy all paper and electronic copies of the original message.
Duff Mckagan wrote:
On 10/16/06, Falcon, George
wrote: IIRC, SuSE doesn't include ksh as one of its standard offerings... which is one reason I went with Fedora for a recent project here. That was easier and quicker for me than installing ksh separately to SuSE.
As for the script, put an ampersand immediately after the greater than symbol.
I use " 2>&1 " to redirect both standard output and standard error to another file, as in
gzip /opt/Novadigm/gsd/scripts/backup/*.tar 2>&1 | tee -a /opt/Novadigm/gsd/log/$logfile
Yeah..this script seems to work. 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. :)
Also people have been telling me on this same thread that ksh does exist for SuSE and its also there in the CDs, but I gave it a shot and was not able to find them.
I've been using ksh since the early 90s and always install it on all my boxes. I know it's available for SuSE 9.0 and up. Further, I've always installed it from the box sets. -- Until later, Geoffrey Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. - Benjamin Franklin
* Duff Mckagan
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
On Monday 16 October 2006 20:22, Duff Mckagan wrote:
Also people have been telling me on this same thread that ksh does exist for SuSE and its also there in the CDs, but I gave it a shot and was not able to find them.
stephan@owl:/media/suse/suse> find . -name '*ksh*.rpm' ./i586/ksh-93r-8.i586.rpm -- ----- stephan@s11n.net http://s11n.net "...pleasure is a grace and is not obedient to the commands of the will." -- Alan W. Watts
Duff Mckagan schreef: (snip)
Also people have been telling me on this same thread that ksh does exist for SuSE and its also there in the CDs, but I gave it a shot and was not able to find them.
Install pin. Then this information will be provided by "pin <name>". Use yast to install pin. :-)
I also have Slackware 10.2 installed on this machine and its got ksh. :)
Good for you. BTW I couldn't think of one single reason for using the Korn shell instead of bash, but if you insist... Regards, -- Jos van Kan registered Linux user #152704
participants (5)
-
Duff Mckagan
-
Geoffrey
-
Jos van Kan
-
Patrick Shanahan
-
stephan beal