|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error in the o/p says bad file descriptor...
Code:
Error is thrown where it is highlighted |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
try assinging the value of the Code:
wc -l to a variable before going to test. Also enclose the variable $dline inside "" Code:
~# grt=`sort -nr filename|head -1`
~# JJ=`wc -l filename."$KK"| awk '{ print $1 }'`
~# if [ "$grt" == "$JJ" ]; then echo $JJ; else echo "Not true"; fi
Not true |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
I dint get wat u aiming to explain....
|
|
#4
|
|||
|
|||
|
comparing two numbers should be done via Code:
== rather than Code:
-eq , as well. rest is for your understanding . |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Quote:
== is for string comparison and -eq is for numeric comparison. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
I can't see where the while loop in your script in post #1 reads from; as is it would read from stdin which might be your terminal. Are you sure the variable
dline holds a valid file name?
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
If you don't want wc to print a filename, don't provide one as an argument. Instead, redirect the command's standard input: Code:
wc -l < filename Regards, Alister |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 18-Mar-2012 14:25:03.209 general: error: socket: file descriptor exceeds limit (4096/4096) | sandeep.tk | Solaris | 1 | 03-18-2012 12:21 PM |
| ufsdump from Solaris to ubuntu fails with bad file descriptor | in2deep | Ubuntu | 1 | 06-27-2011 03:58 AM |
| utime returning -1 BAD File DEscriptor | parusasi | Programming | 15 | 02-04-2011 04:59 PM |
| Script to search a bad record in a file then put the record in the bad file | shilendrajadon | Shell Programming and Scripting | 2 | 12-28-2007 09:02 AM |
| bad file descriptor? | ftb | UNIX for Dummies Questions & Answers | 1 | 02-20-2002 06:19 PM |
|
|