Hello i am using hp unix, i am trying to loop through the last 20 days (with respect to the current date) using a for loop .
for (( c=1; c<=5; c++ ))
do
day$c=$(perl -e 'use POSIX;print strftime "%Y%m%d\n",localtime time-86400*$c;')
done
later do some operations with day$c
issue is that for some strange reason 86400*$c is not executing , can any one point out the mistake ? thanks in advance .
Try different quoting:
(I’m not familiar with HPUX, but it looks like
$cisn’t getting interpolated by the shell.)Edit: Or the slightly shorter: