[luau] Shell Script Help
Ray Strode
halfline at hawaii.rr.com
Fri Jul 12 14:04:00 PDT 2002
Mike Ballon wrote:
>To those that don't know me Aloha,
>
Nice to meet you.
>to those that do how come nobody told me about the new list :P
>
Well, if you were a member of the old list, it was posted there.
>The scipt below works fine a Linux box but I need it work on my Solairs 2.7
>box. Basically I just need a scipt that writes yesterday's date in the
>format of yymmdd, thanks.
>
>#!/bin/sh
># used to test date
>
>TODAY=`date +%y%m%d`
>echo $TODAY
>echo "---"
>#Get day ago
>YESTERDAY=$(date --date "1 day ago" +%y%m%d)
>echo $YESTERDAY
>
>
There are two things I see. $(...) is a bash construct I believe and
not part of
any traditional bourne shell implementations (it's not POSIX or otherwised
standardized I don't think), so you should use backticks like you did
for TODAY=...
on the line that starts YESTERDAY=... The other thing I see is --date
is a GNU
style option. Solaris uses BSD-based tools, by default, so --date won't
work. I just
checked the man page on uhunix2 and there doesn't appear to be any
comparable
option, so you should either install GNU's sh-utils, or write a small C
program to do
what you want. If you decide to go with writing the C program and you
need help,
just ask.
Another option would be perl (if you have it installed)...
--Ray Strode
More information about the LUAU
mailing list