Code:
#create LinuxScanFolders cfg file if not present
if [[ -f "/var/log/VirusVault/scanvirus.cfg" ]]; then
printf ""
else
printf "creating LinuxScanFolders\n"
cat > /var/log/VirusVault/scanvirus.cfg <<EOL
__________scanvirus configuration__________
___________________________________________
Excluded Scan Folders
etc dev proc tmp mnt media srv .snapshots
___________________________________________
Time Date Stamp
date '+%Y-%m-%d %I:%M%P'
___________________________________________
EOL
fi
#setup configuration lines into array
IFS=$'\n' read -d '' -r -a lines < /var/log/VirusVault/scanvirus.cfg
printf "excluded folders: %s\n" "${lines[3]}"
printf "time date stamp : %s\n" "${lines[6]}"
Time_Date_Stamp=$( "${lines[6]}" )
# check for date command error
#if [[ $? != 0 ]]; then
# echo "----- Time_Date_Stamp error -----"
# exit 1
#fi
printf "%s\n" $Time_Date_Stamp
Code:
excluded folders: etc dev proc tmp mnt media srv .snapshots
time date stamp : date '+%Y-%m-%d %I:%M%P'
./scanvirusa: line 136: date '+%Y-%m-%d %I:%M%P': command not found