Sponsored Content
Top Forums Shell Programming and Scripting Ignore error and get ls file count Post 302311776 by gbowdridge on Wednesday 29th of April 2009 01:34:43 PM
Old 04-29-2009
in my test, simply redirecting stderr of the ls command to /dev/null achived this:

num=`ls /appsrv/tmp/PrjRefData_20090428-*_in.xml 2>/dev/null | wc -l`

you could also add some code after the ls to see the return code is non-zero ($?), but it seems from testing the above that this is not nessesary as the above line set num to 0 for that example.

This is what you could add, as the very next line of execution, for reduntant error checkig, or an alternate solution:

if [ $? ne 0 ]
then
num=0
fi
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count the record count in an EBCDIC file.

How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies

2. Shell Programming and Scripting

reading from a file and pass as variables and ignore # in the file

file.txt contains ------------------ sat1 1300 #sat2 2400 sat3 sat4 500 sat5 I need to write a shell script that will output like the below #output sat1.ksh 1300 sat3.ksh sat4.ksh 500 sat5.ksh my try ------- (4 Replies)
Discussion started by: konark
4 Replies

3. Shell Programming and Scripting

Getting Sum, Count and Distinct Count of a file

Hi all this is a UNIX question. I have a large flat file with millions of records. col1|col2|col3 1|a|b 2|c|d 3|e|f 3|g|h footer**** I am supposed to calculate the sum of col1 1+2+3+3=9, count of col1 1,2,3,3=4, and distinct count of col1 1,2,3=c3 I would like it if you avoid... (4 Replies)
Discussion started by: singhabhijit
4 Replies

4. UNIX for Dummies Questions & Answers

cat : ignore I/O error

Hello, I have to backup some cds but I get an I/O error message when I hit a bad sector (using the command cat) and my question is : what can I do to force the system to ignore theses errors (or all kind of errors) and let the process keep going? (sorry for any eventuals language errors, I am... (6 Replies)
Discussion started by: Actraiser47
6 Replies

5. Shell Programming and Scripting

how to ignore multiline comment from a file while reading it

Hi friends , I want to ignore single and multiline comment( enclosed by " \* *\" ) of a file whle reading it. I am using the below code. nawk '/\/\*/{f=1} /\*\//{f=0;next} !f' proc.txt | while read str do ... done The problem is its working partially. that is its failing in one... (1 Reply)
Discussion started by: neelmani
1 Replies

6. Shell Programming and Scripting

Ignore garbage output file

Hi All, below is my shell script #!/bin/sh set -x echo "test for multiple values" UIDPSWD=`cat /projects/feeds/twest/uidpswd` echo "oracle connection test" full=/projects/feeds/twest/test_file values=`cut -d'|' -f1 $full|sed -e "s/.*/'&'/" -e 's/$/,/g' -e '$s/,$//'` sqlplus $UIDPSWD... (2 Replies)
Discussion started by: krupasindhu18
2 Replies

7. Emergency UNIX and Linux Support

How to ignore Netout Error.?

Hi All , Am using unix KSH . I would like to clarify two doubts. Whenever am transfering the zero size file am getting the warning message netout. files will be transferred to target server or not? I have used the code as if then VAR="ftp.sh -c put ${FILE} ${FILE}... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

8. Shell Programming and Scripting

How to ignore error in command in bash script?

Hello, i have bash script where im cycling some command for different lines in external file. example: while read domain;do nslookupout=$(nslookup -type=ns $domain) || true another commands done < filenamewithdomains i added: || true after the command in belief it will just skip... (6 Replies)
Discussion started by: postcd
6 Replies

9. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

10. Shell Programming and Scripting

Grep and ignore list from file

cat /tmp/i.txt '(ORA-28001|ORA-00100|ORA-28001|ORA-20026|ORA-20025|ORA-02291|ORA-01458|ORA-01017|ORA-1017|ORA-28000|ORA-06512|ORA-06512|Domestic Phone|ENCRYPTION)' grep -ia 'ORA-\{5\}:' Rep* |grep -iavE `cat /tmp/i.txt` grep: Unmatched ( or \( Please tell me why am i getting that (6 Replies)
Discussion started by: jhonnyrip
6 Replies
KISSNETD(8)						   Linux System Managers Manual 					       KISSNETD(8)

NAME
kissnetd - Create a virtual network. SYNOPSIS
kissnetd [-f size] [-v] [-p <num> | tty... ] DESCRIPTION
Kissnetd allows the creation of a virtual network of AX.25 systems that use the KISS protocol. Each tty named on the command line is opened and any KISS frames received on tty is copied to the other ttys. This allows a number of AX.25 systems to share the same packets. OPTIONS
-p num Automaticaly allocate num Unix98 slave pty's via /dev/ptmx. These are written to stdout and could be parsed by your startup scripts. "kissnetd -p 3" is an comfortable alternative to "kissnetd /dev/ptmx /dev/ptmx /dev/ptmx". -f size This sets the maximum KISS frame size that the program will handle. The default is 512 bytes which will be adequate under most circumstances. -v Enables verbose mode, tracing of data passed is sent to standard output. SEE ALSO
kissattach(8), kissparms(8), mkiss(8). AUTHOR
Frederic Rible F1OAT <frible@teaser.fr> Linux 13 October 1996 KISSNETD(8)
All times are GMT -4. The time now is 10:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy