Может ли кто-нибудь помочь мне понять следующий фрагмент кода, который определяет даты начала и окончания, чтобы выбрать данные из db.понимание части скрипта ksh
# Get the current time as the stop time.
#
stoptime=`date +"%Y-%m-%d %H:00"`
if test $? -ne 0
then
echo "Failed to get the date"
rm -f $1/.optpamo.pid
exit 4
fi
#
# Read the lasttime file to get the start time
#
if test -f $1/optlasttime
then
starttime=`cat $1/optlasttime`
# if the length of the chain is zero
# (lasttime is empty) It is updated properly
# (and I wait for the following hour)
if test -z "$starttime"
then
echo "Empty file lasttime"
echo $stoptime > $1/optlasttime
rm -f $1/.optpamo.pid
exit 5
fi
else
# If lasttime does not exist I create, it with the present date
# and I wait for the following hour
echo "File lasttime does not exist"
echo $stoptime > $1/optlasttime
rm -f $1/.optpamo.pid
exit 6
fi
Благодаря
Какие биты вы неясны? –
Похоже, что у вас возникли проблемы с форматированием фрагментов сценария. Если вы выделите их и нажмите кнопку над редактором с помощью значка '0101', он должен отформатировать их как код. –
сценарий хорошо прокомментирован, так что вы не понимаете? – ghostdog74