I have a script which checks for *.txt files in a particular directory and if no files were found then it goes into sleep for 10 secs and looks back for files again and if any files were found then the script does some processing with the files found, which is my requirement too.
Code:
FILE_EXISTS=`ls ${INPUT_DIR}/*.txt | wc -l`if [ $FILE_EXISTS -eq 0 ];thenecho "No file found hence sleeping for 10 secs..."sleep 10;continue;fi
but when ever no files were found a message saying
Code:
ls: 0653-341 The file /home/sys/*.done does not exist.
Is being displayed which I do not want to be displayed. So I used
Code:
>/dev/null 2>&1
in the script as below
Code:
FILE_EXISTS=`ls ${INPUT_DIR}/*.txt >/dev/null 2>&1 | wc -l`if [ $FILE_EXISTS -eq 0 ]; then echo "No file found hence sleeping for 10 secs..." sleep 10; continue;fi
now the message is not being displayed but even if files exists in the directory, the file count is not being assigned to the variable FILE_EXISTS. Doing so the script does not go further to do the required file processing but instead it still goes into sleep for 10 secs. Could any one please suggest any correction which needs to be made to my script.
Setup Info:
This User Id and Password mention below are being used with the ISQL command to connect to a sybase database so they are likely to not be the same as those that were signed on from the session.
Situation:
Using a korn shell, the shell prompts for a User Id and Password. During the... (1 Reply)
Hello there,
I am having a text file, the following is written in that text file:
Full range of accounts:
Account1
Account2
Account3
Account4
Now my question is. how to take that file and produce another file having only the accounts (i.e., suppressing the fist line of that... (4 Replies)
I want to check whether the variable read from the console is number or character , so i used echo $option|grep and checked the reuslt returned by grep cmd using $?
But since I use echo the value is getting printed in the screen , I want to supress the o/p. Can anyone suggest how this can be... (1 Reply)
hi
I'm new here so my question maybe be retarded or out of place:
Is there a way to suppress the "No such file or directory" error message when using the "ls" command ?
thanks (5 Replies)
hi
i want to replace spaces by comma
my file is
ADD 16428 170 160 3 WNPG 204 941 No 204802
ADD 16428 170 160 3 WNPG 204 941 No 204803
ADD 16428 170 160 3 WNPG 204 941 No 204804
ADD... (9 Replies)
I need to suppress the error message for commands. I have given the command like below
lsb_release -dr 2>/dev/null
But it is not working.
Am testing with Red Hat Linux release 9. Guide me.
Thanks in advance (2 Replies)
Hi all,
I've been pulling my hair out with this problem for 3 days:wall: now without success any help would be massively appreciated.
Basically the script is used to shutdown a rails server so a new IP address can be assigned, the shutdown part is taken care of in function_one using the... (2 Replies)
Hello,
On 4/20/2018, we performed a disk replacement on our IBM 8202 P7 server. After the disk was rebuilt, the SAS Disk Array sissas0 showed a status of degraded. However, the pdisks in the array all show a status of active.
We did see a message in errpt. DISK ARRAY PROTECTION SUSPENDED.
... (1 Reply)
Hi,
When I run the command "print_manifest | grep "Main Memory", I get the note :
# /opt/ignite/bin/print_manifest | grep "Main Memory"
NOTE: Could not read the /etc/resolv.conf file.
Main Memory: 196498 MB
#
How do I suppress the part :
NOTE: Could not read the... (4 Replies)
Is there any way to print the colorful message in the terminal (which is the output of a simulation) to the log file with the same color.
The colorful message at the terminal is obtained by the following codes:
/////////////codes start here///////////////////////////////////////
... (5 Replies)