Sponsored Content
Full Discussion: ksh Logging
Top Forums UNIX for Beginners Questions & Answers ksh Logging Post 303032625 by bakunin on Thursday 21st of March 2019 05:15:43 AM
Old 03-21-2019
In addition to what RudiC already said: if you want to redirect larger parts of a script i would - simply for better readability - not shift around output streams in a way so that one depends on the other. I would set them separately and independently like this:

Code:
exec 2>/some/file
exec 1>/some/file

If you later decide to redirect one or the other to somewhere else it won't affect the other redirecction at all.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Logging

I have a SCO R5 Open Server Box running at a remote location, and from time to time it seems to "spontaneously" re-boot itself. Is there a specific log file that I can examine to see why the machine is doing this ? Any suggestions gratefully appreciated (1 Reply)
Discussion started by: pcs7088
1 Replies

2. Shell Programming and Scripting

Logging

G'day Just wondering if anyone out there knows how to log files, using the example I provided in the earlier message / question earlier today: :confused: If I was to backup a file, how could I setup a log file to record the filename, date (This one I've got figured), and that the file was... (4 Replies)
Discussion started by: Aussie_Bloke
4 Replies

3. UNIX for Dummies Questions & Answers

logging when someone changes to su

Is there a file that captures info whenever someone logs to su? i know it comes across as standard output on the server, but is it saved anywhere? Time and date info included?? thanks, kym (1 Reply)
Discussion started by: kymberm
1 Replies

4. UNIX for Dummies Questions & Answers

Asking about logging in

Hi, just wriiten a sh script and as my script will try to log into another server to delete some files but when i run , it keeps on saying that my files do not exist. It seems to refer to my local directory instead. Below is my script : FTP_HOST=ip_number FTP_USER="user password" ... (1 Reply)
Discussion started by: blueberry80
1 Replies

5. UNIX for Dummies Questions & Answers

need more logging

Hi all! On our current Solaris 8 machine we only have "standard" logging configured, and now i need to put on more. What i specificly need is time in the logfiles. Ex. When a user is logging in, when a user makes it self SU. etc. Regards... dOzY (3 Replies)
Discussion started by: dozy
3 Replies

6. Post Here to Contact Site Administrators and Moderators

Constant Logging In (After Logging Out)

Hi Everyone. First, I want to thank all of you for letting me participate in this great group. I am having a bit of a problem. After I get an email from a responder, I login to make my reply. In the mean time I get another response by email from another member, I go to reply to them and I... (6 Replies)
Discussion started by: Ccccc
6 Replies

7. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

8. Shell Programming and Scripting

ksh - find command with 2 actions attached and error logging

Hi there, I'm encountering problems on an AIX system when using following in my script. find . -name *.edi -type f -exec sh -c 'scp {} $user@$server:$path || exit 5; mv {} $sent || exit 7' \; the error i get is following find: 0652-018 An expression term lacks a required... (4 Replies)
Discussion started by: Kerberos
4 Replies

9. Shell Programming and Scripting

Adding logging feature to ksh script?

Good morning all, I have a ksh script that I would like to log all "Terminal" out to a log file. I have tried several different methods to no avail! Below is my script and any advice or assitance would be great! The script works great but can not figure out how to log all outputs to a log... (4 Replies)
Discussion started by: TAllison
4 Replies

10. Linux

Syslog not logging successful logging while unlocking server's console

When unlocking a Linux server's console there's no event indicating successful logging Is there a way I can fix this ? I have the following in my rsyslog.conf auth.info /var/log/secure authpriv.info /var/log/secure (1 Reply)
Discussion started by: walterthered
1 Replies
exec(1) 							   User Commands							   exec(1)

NAME
exec, eval, source - shell built-in functions to execute other commands SYNOPSIS
sh exec [argument...] eval [argument...] csh exec command eval argument... source [-h] name ksh *exec [arg...] *eval [arg...] DESCRIPTION
sh The exec command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may appear and, if no other arguments are given, cause the shell input/output to be modified. The arguments to the eval built-in are read as input to the shell and the resulting command(s) executed. csh exec executes command in place of the current shell, which terminates. eval reads its arguments as input to the shell and executes the resulting command(s). This is usually used to execute commands generated as the result of command or variable substitution. source reads commands from name. source commands may be nested, but if they are nested too deeply the shell may run out of file descrip- tors. An error in a sourced file at any level terminates all nested source commands. -h Place commands from the file name on the history list without executing them. ksh With the exec built-in, if arg is given, the command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may appear and affect the current process. If no arguments are given the effect of this command is to mod- ify file descriptors as prescribed by the input/output redirection list. In this case, any file descriptor numbers greater than 2 that are opened with this mechanism are closed when invoking another program. The arguments to eval are read as input to the shell and the resulting command(s) executed. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. EXIT STATUS
For ksh: If command is not found, the exit status is 127. If command is found, but is not an executable utility, the exit status is 126. If a redi- rection error occurs, the shell exits with a value in the range 1-125. Otherwise, exec returns a zero exit status. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 17 Jul 2002 exec(1)
All times are GMT -4. The time now is 07:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy