bash question
Thomas M. Albright
talbright at tarogue.net
Mon Sep 23 11:52:43 EDT 2002
On Mon, 23 Sep 2002 pll at lanminds.com wrote:
>
> 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.
>
Yay! Thanks!
--
TARogue (Linux user number 234357)
You can always tell a Texan, but you can't tell him much. - Chris Wall
More information about the gnhlug-discuss
mailing list