11-28-2001
Looking at your code I couldn't believe that it would run at all. But I tried "echo aaa > bbb ccc" and sure enough I created a file called bbb with the contents "aaa ccc". I never knew you could inbed redirects in the middle of an argument list.
That's what you are doing with "if [ $a > $b ]". You should be creating an output file. The [ is just a normal unix command that expects it's last argument to be ]. In the early days of the bourne shell, it was a link to the test command and sat in /usr/bin. Later it became a built-in, but it still is a command. It never understood > as a comparison operator. There is a -gt but it only works on integers and will barf on your time format.
You don't want an integer compare, you want an ascii string compare. So switch to [[ which is a keyword rather than a command:
if [[ $a > $b ]]
should work fine.
And it's korn, not korne.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i am used to making scripts for hp-ux. but lately i tried to make some for solaris. the problem is that when i tried to execute it it gave me an error the "let: not found". why is that? how can i perform an arithmetic function in the solaris shell script?
thanks :) (2 Replies)
Discussion started by: inquirer
2 Replies
2. UNIX for Dummies Questions & Answers
I am a beginner and I have been searching the web all morning for this answer but can't find it anywhere.
I know that
prtint 1*2
will return
1*2
what if i actually want the problem to be calculated
so i want
print 1*2
to return
2
How is this done? (3 Replies)
Discussion started by: tygun
3 Replies
3. Shell Programming and Scripting
Helloo..
I am trying one very simple thing I could not find anything on google..
I have 2 integer variable..and I need to do division...in ksh
where $catch and $num are integer variable..
I tryed with this:
printf "%0.2f" $final=$catch/$num
but it does not work..
any help is... (12 Replies)
Discussion started by: amon
12 Replies
4. Shell Programming and Scripting
Yes I know tcsh sucks for scripting and arithmetic but I have to write a script for multiple users and they all use tcsh.
I have this variable that I 'set' with but pulling numbers off of stings with
set STUFF = `grep string file | awk command`
Now I would like to add up the numbers that... (4 Replies)
Discussion started by: gobi
4 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I have a list of 'inputs' and i want to convert those on the second list named 'Desired Outputs', but i don't know how to do it?
Inputs Desired Outputs
1 2
94 4
276 8
369 10
464 12 ... (0 Replies)
Discussion started by: filda
0 Replies
6. UNIX for Dummies Questions & Answers
Hello all,
I'd like to know how to perform arithmetic on multiple files. I have got many tab-delimited files. Each file contains about 2000 rows and 2000 columns.
What I want to do is to to sum the values in each row & column in every file.
The following explains what I want to do;
... (9 Replies)
Discussion started by: Muhammad Rahiz
9 Replies
7. Shell Programming and Scripting
Hello,
Could someone explain how this one is possible:
# @ x = 10 - 11 + 3
# echo $x
-4
I know that writing script using csh is bad idea, but I need to write few lines.
thanks
Vilius (2 Replies)
Discussion started by: vilius
2 Replies
8. Shell Programming and Scripting
Hi,
I need to process a file which contains below data. Usually the files contains both Start and Finish time. but for Few records, it contains only Start. For those records I need to add the finish line by adding 5 minutes to Start time.
Started BBIDX Tue Jun 1 15:15:11 EDT 2010 292308... (1 Reply)
Discussion started by: siba.s.nayak
1 Replies
9. Shell Programming and Scripting
Hello fellow forum members,
I wrote below piece of code to calculate the date after a given date -
date=$DATE_FINAL
declare -a max_month=(0 31 28 31 30 31 30 31 31 30 31 30 31)
eval $(echo $date|sed 's!\(....\)\(..\)\(..\)!year=\1;month=\2;day=\3!')
(( year4=year%4 ))
(( year100=year%100... (9 Replies)
Discussion started by: ektubbe
9 Replies
10. Shell Programming and Scripting
I need to divide the number of white spaces by total number of characters in a file using bash. I am able to get the number of white spaces correctly using:
tr -cd < afile | wc -c
I am also able to get the total number of characters using:
wc -c afile
How do I divide the first... (2 Replies)
Discussion started by: ngabrani
2 Replies
LEARN ABOUT REDHAT
displayofccc
DisplayOfCCC(3X11) XLIB FUNCTIONS DisplayOfCCC(3X11)
NAME
DisplayOfCCC, VisualOfCCC, ScreenNumberOfCCC, ScreenWhitePointOfCCC, ClientWhitePointOfCCC - Color Conversion Context macros
SYNTAX
DisplayOfCCC(ccc)
XcmsCCC ccc;
VisualOfCCC(ccc)
XcmsCCC ccc;
ScreenNumberOfCCC(ccc)
XcmsCCC ccc;
ScreenWhitePointOfCCC(ccc)
XcmsCCC ccc;
ClientWhitePointOfCCC(ccc)
XcmsCCC ccc;
ARGUMENTS
ccc Specifies the CCC.
DESCRIPTION
The DisplayOfCCC macro returns the display associated with the specified CCC.
The VisualOfCCC macro returns the visual associated with the specified CCC.
The ScreenNumberOfCCC macro returns the number of the screen associated with the specified CCC.
The ScreenWhitePointOfCCC macro returns the screen white point of the screen associated with the specified CCC.
The ClientWhitePointOfCC macro returns the client white point of the screen associated with the specified CCC.
SEE ALSO
XcmsCCCOfColormap(3X11), XcmsConvertColors(3X11), XcmsCreateCCC(3X11), XcmsDefaultCCC(3X11), XcmsSetWhitePoint(3X11)
Xlib - C Language X Interface
X Version 11 Release 6.6 DisplayOfCCC(3X11)