Sponsored Content
Full Discussion: rm error codes and logging
Top Forums Shell Programming and Scripting rm error codes and logging Post 302606111 by gull04 on Friday 9th of March 2012 02:42:57 PM
Old 03-09-2012
You could try;

Code:
do
if [[ -f /profiles/${array[i]}path/to/file.extension ]]
               then
               rm -v /profiles/${array[i]}path/to/file.extension >> ~/Desktop/MyLog.log
               else
               print "A Message" >> ~/Desktop/MyLog.log
          fi
done

You had better check the syntax on the if as I'm currently working my way through a nice bottle of 18 Year Old Glenlivett.

Regards

Dave
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

GNU's make error codes - list

Hi, I often encounter make errors. Many a times, a corresponding error code is also shown, like make: Error 56 (ignored) make: Error 91 (ignored) make: Error 96 (ignored) et al. I tried google'ing as well as searching this forum for what these error codes mean. I know, make... (1 Reply)
Discussion started by: vino
1 Replies

2. AIX

pSeries 610 error codes

I have been given some pSeries AIX servers to maintain. One of the servers wont come up after a shutdown and the following code is showing on the server: 10118401 How do I look up the error code? (2 Replies)
Discussion started by: dangral
2 Replies

3. UNIX and Linux Applications

Printing unix error codes

Hi Friends, I need your help in understanding this: :rolleyes: I want to print the error numbers returned by the system calls (not the actual integers but the strings that they match to). The error numbers like EACCESS, ENOMEM, ENOENT etc ... For eg: returnCode = open(somefile,... (2 Replies)
Discussion started by: vijaya2006
2 Replies

4. Shell Programming and Scripting

ssh use of error codes

I want to import the info to shell when the connection to remote host was closed . I have follwed by ssh errors but how to use variables in script. I am thinking out loud the shell script could look as follow: svnvaraible=$ERROR_SSH_CONNECTION_LOST if ; then break fi (1 Reply)
Discussion started by: Michal Janusz
1 Replies

5. Solaris

Sun T2000 error codes

I got a Power supply failure. I replaced the power supply and still got the error. Any ideas on what I should try next? (1 Reply)
Discussion started by: 642fiddi
1 Replies

6. UNIX for Advanced & Expert Users

Error Codes for VCS

Do we have common VCS error codes for all platforms. eg. 10195 Agent(s) for group %s failed on system %s for all Linux,Solaris and windows ? (1 Reply)
Discussion started by: NIMISH AGARWAL
1 Replies

7. Shell Programming and Scripting

Capturing Oracle SQL Error Codes

My issue pertains to earlier posts like exit unix script after sqlerror in procedure - dBforums SQLPLUS Error Capturing | Unix Linux Forums | Shell Programming and Scripting We are executing PL/SQL blocks from shell scripts using SQLPLUS. The error code has to be captured into a logfile that... (3 Replies)
Discussion started by: jerome_rajan
3 Replies

8. Shell Programming and Scripting

FTP exit and error codes

I have a script which connects to a remote server via FTP and gets some file from there. #!/bin/bash /usr/bin/ftp -n remote.hostname.com <<EOF quote USER user123 quote PASS password123 lcd /dir1/dir2/dir3 cd / mget file_pattern* close bye EOF rc=$? if ] ... (7 Replies)
Discussion started by: dhruuv369
7 Replies

9. Shell Programming and Scripting

BASH - Propagation of error codes

Hello. I use bash functions which are in different script files. Theses scripts function files are sourced when necessary. As function does not easily return string value, Value are return using the echo function, and a return code is returned.. Now here my question : In the main script I... (11 Replies)
Discussion started by: jcdole
11 Replies

10. Shell Programming and Scripting

Capturing error codes in SFTP commands

Hi, I have been using the SFTP commands in my reusable shell scripts to perform Get/Put operation. The script has a list of 6 errors which i am capturing through the log file using grep command. But I feel there might me more errors which the script might need to capture. I tried to capture the... (2 Replies)
Discussion started by: Bobby_2000
2 Replies
SYSLOGOUT(8)						      System Manager's Manual						      SYSLOGOUT(8)

NAME
syslogout - modular centralized shell logout mechanism DESCRIPTION
syslogout is a generic approach to enable centralized shell logout actions for all users of a given system in a modular and centralized way mostly aimed at avoiding work for lazy sysadmins. It has only been tested to work with the bash shell. It basically consists of the small /etc/syslogout shell script which invokes other small shell scripts having a .bash suffix which are con- tained in the /etc/syslogout.d/ directory. The system administrator can drop in any script he wants without any naming convention other than that the scripts need to have a .bash suffix to enable automagic sourcing by the /etc/syslogout script. For shell sessions, the contents of /etc/syslogout.d/" will be sourced by every user at logout if the following lines are present in his $HOME/.bash_logout: if [ -f /etc/syslogout ]; then . /etc/syslogout fi If used for X sessions it is advisable to include the former statement into the Xreset script of the X display manager instead to prevent that closing of an terminal emulator window yields unexpected results in your running X session if your X11 terminal emulator is using a login shell. Be sure then to run it under the user-id of the X session's user. See the example files in /usr/share/doc/syslogout/ for illustration. Users not wanting /etc/syslogout to be sourced for their environment can easily disable it's automatic mechanism. It can be disabled by simply creating an empty file called $HOME/.nosyslogout in the user's home directory using e.g. the touch(1) command. Any single configuration file in /etc/syslogout.d/ can simply be overridden by any user by creating a private $HOME/.syslogout.d/ directory which may contain a user's own version of any configuration file to be sourced instead of the system default. It's names have just to match exactly the system's default /etc/syslogout.d/ configuration files. Empty versions of these files contained in the $HOME/.syslo- gout.d/ directory automatically disable sourcing of the system wide version. Naturally, users can add and include their own private scripts to be automagically executed by /etc/syslogout at logout time. OPTIONS
There are no options other than those dictated by shell conventions. Anything is defined within the configuration scripts themselves. SEE ALSO
The README files and configuration examples contained in /usr/share/doc/syslogout/ and the manual page for bash(1), xdm(1x), xdm.options(5), and wdm(1x). Recommended further reading is everything related with shell programming. If you need a similar mechanism for executing code at login time check out the related package sysprofile(8) which is a very close compan- ion to syslogout. BUGS
syslogout in its current form is mainly restricted to bash(1) syntax. In fact it is actually a rather embarrassing quick and dirty hack than anything else - but it works. It serves the practical need to enable a centralized bash configuration until something better becomes available. Your constructive criticism in making this into something better" is very welcome. Before i forget to mention it: we take patches... ;-) AUTHOR
syslogout was developed by Paul Seelig <pseelig@debian.org> specifically for the Debian GNU/Linux system. Feel free to port it to and use it anywhere else under the conditions of either the GNU public license or the BSD license or both. Better yet, please help to make it into something more worthwhile than it currently is. SYSLOGOUT(8)
All times are GMT -4. The time now is 03:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy