logMsg='Started by '${USER}
LOG_MESSAGE "${logMsg}"
resultCode=$?
if [[ ${resultCode} -ne ${OK} ]]; then
return ${resultCode}
fi
touch ${FILELISTPATH}
resultCode=$?
if [[ ${resultCode} -ne ${OK} ]]; then
logMsg='failed to create file list:'${FILELISTPATH}
LOG_ERROR "${logMsg}" CUSTOM_PREPROCESS ${FATAL}
fi
if [[ ! -r $MMREJ ] && [ ! -w $MMREJ ] ||[ ! -r $MMIN ] && [ ! -w $MMIN ] || [ ! -r $MMLOG ] && [ ! -w $MMLOG ]];then
return ${FATAL}
Hello raka123,
Welcome to UNIX forums, good that you are showing us your effort/code sample; but mentioning 1 liner in title will NOT help people to help you.
So kindly update your post with complete details about your complete ask. Wherever applicable try to post samples of input and expected output too.
Thanks,
R. Singh
Assuming that you mean that you want to terminate this code by returning $FATAL
if one or more of the files mentioned in your if
statement tests are not both readable and writeable, you probably want to change:
if [[ ! -r $MMREJ ] && [ ! -w $MMREJ ] ||[ ! -r $MMIN ] && [ ! -w $MMIN ] || [ ! -r $MMLOG ] && [ ! -w $MMLOG ]];then
return ${FATAL}
to something more like:
if [ ! -r "$MMREJ" ] || [ ! -w "$MMREJ" ] || \
[ ! -r "$MMIN" ] || [ ! -w "$MMIN" ] || \
[ ! -r "$MMLOG" ] || [ ! -w "$MMLOG" ]
then return "${FATAL}"
fi
Note, also, that none of the variables this script is using have been defined by anything you have shown us. If they aren't defined before they are used, the chances of any of this working are pretty small.