[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log
Subject:    Re: keeping digits
From:       Mate Wierdl <mw () wierdlmpc ! msci ! memphis ! edu>
Date:       2000-07-06 0:42:43
[Download RAW message or body]

Better to use quotes:

#! /bin/sh
# cat logfile | viewlog.sh              -> 2000-07-05 08:37:33
# cat logfile | viewlog.sh 2            -> 2000-07-05 08:37:33.21
# cat logfile | viewlog.sh 9 or greater -> 2000-07-05 08:37:33.213730500

if [ $# = 0  -o "$1" = "0" ]; then
    tai64nlocal | awk  '{ $2 = substr($2,1,8); print }'
elif [ "$1" -gt "0" -a "$1" -lt "9" ]; then
    tai64nlocal | awk  '{ $2 = substr($2,1,'`expr $1 + 9`'); print }'
else
    tai64nlocal
fi

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic