Sponsored Content
Top Forums Shell Programming and Scripting Loop through files in a directory Post 76021 by vino on Friday 24th of June 2005 04:54:15 AM
Old 06-24-2005
Quote:
Originally Posted by ssk
You can run the script in cron also to check for the file and process the same if it exists. Just a suggestion. Smilie
True. cron can be used. And I think it would be a better suggestion than the sleep.

The & makes the script remain alive throughout. If done as a cron job, then once the job is done, the script exits until it is called again.

My 2 cents,
Vino
 

10 More Discussions You Might Find Interesting

1. AIX

loop through the directory for files and sort by date and process the first file

hello i have a requirement where i have a direcotry in which i get files in the format STOCKS.20080114.dat STOCKS.20080115.dat STOCKS.20080117.dat STOCKS.20080118.dat i need to loop through the directory and sort by create date descending order and i need to process the first file. ... (1 Reply)
Discussion started by: dsdev_123
1 Replies

2. Shell Programming and Scripting

Loop certain code to all files within directory

Hi all, Can somebody help me with this problem pls. I need to extract one specific line from each files in a folder and put the all lines extracted in a unique output file in the following format. line extracted, respective name of file, date of file. I´m, trying the part to extract... (3 Replies)
Discussion started by: cgkmal
3 Replies

3. Shell Programming and Scripting

loop through files in directory

hi all i have some files present in a directory i want to loop through all the files in the directory each time i loop i should change the in_file parameter in the control file and load it into a table using sql loader there is only one table where i have to load alll the files ... (3 Replies)
Discussion started by: rajesh_tns
3 Replies

4. Shell Programming and Scripting

Find the latest directory and loop through the files and pick the error messages

Hi, I am new to unix and shell scripting,can anybody help me in sctipting a requirement. my requirement is to get the latest directory the name of the directory will be like CSB.monthdate_time stamp like CSB.Sep29_11:16 and CSB.Oct01_16:21. i need to pick the latest directory. in the... (15 Replies)
Discussion started by: sudhir_83k
15 Replies

5. UNIX Desktop Questions & Answers

Copy all files in 1 directory to another usinge for-in loop

I was looking to get some help with copying files in one directory to another using a for-in loop. My script file is called copyfile and here is what I have: for file in $(ls -a $1) do cp $file ~/dir-2 done When I run copyfile dir-1 this is what I get cp: omitting directory `.'... (1 Reply)
Discussion started by: Trinimini
1 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Writing a loop to changing the names of files in a directory

Hi, I would like to write a loop to change the names of files in a directory. The files are called data1.txt through data1000.txt. I'd like to change their names to a1.txt through a1000.txt. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

7. Shell Programming and Scripting

Loop through files in a directory

Hello How do I loop through files in a specific directory ? This script is not working! #! /bin/bash FILES=/usr/desktop/input/* For f in $FILES; do awk '-v A="$a" -v B="$b" {$6=($1-64)/2 ;$7=((10^($6/10))/A)^(1/B) ; print}' OFS="\t" $f > /root/Desktop/output/$f.txt; done ... (7 Replies)
Discussion started by: ali.seifaddini
7 Replies

8. Shell Programming and Scripting

Loop through files in directory

I am trying to loop through files in a directory, and sort each file. No matter what changes I make to the code, I get the following errors: 'aunch.sh: line 4: syntax error near unexpected token `do 'aunch.sh: line 4: `for f in ${FILES}/*; do #!/bin/bash FILES=$(pwd) for f in ${FILES}/*;... (1 Reply)
Discussion started by: ldorsey
1 Replies

9. Shell Programming and Scripting

Loop through files in directory

I am trying to loop through files in a directory, and sort each file. No matter what changes I make to the code, I get the following errors: 'aunch.sh: line 4: syntax error near unexpected token `do 'aunch.sh: line 4: `for f in ${FILES}/*; do #!/bin/bash FILES=$(pwd) for f in ${FILES}/*;... (6 Replies)
Discussion started by: ldorsey
6 Replies

10. Shell Programming and Scripting

How to exclude some files from the loop on the directory?

I have one question. On the directory I have many files start with DB.DAILYxxxxxxx.YYYYMMDD.HHMMSS and I have several files with other format, like LET.20170310 daily.20170310 tba.20170310 How can I exclude from my loop DB.DAILY files? I tried ls *20170310* | while read... (4 Replies)
Discussion started by: digioleg54
4 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 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy