bash question
pll at lanminds.com
pll at lanminds.com
Mon Sep 23 11:44:05 EDT 2002
In a message dated: Mon, 23 Sep 2002 11:37:40 EDT
"Thomas M. Albright" said:
>If the due date is greater than today, it outputs the message "Due in x
>days." If the due date is less than today I get a message saying "You
>are -x days past due." How can I convert the negative number into a
>positive one in bash?
Well, assuming that 'x' is a variable which contains some whole
number representing the number of days in which 'it' is due, a
negative number representing an over-due 'it', then:
abs_x=`echo '$x' | sed s/-//`
ought to do it.
HTH,
--
Seeya,
Paul
--
It may look like I'm just sitting here doing nothing,
but I'm really actively waiting for all my problems to go away.
If you're not having fun, you're not doing it right!
More information about the gnhlug-discuss
mailing list