#create LinuxScanFolders cfg file if not present
if -f "/var/log/VirusVault/scanvirus.cfg" ]]; then
printf ""
else
printf "creating scanvirus configuration
"
cat > /var/log/VirusVault/scanvirus.cfg <<EOL
__________scanvirus configuration__________
___________________________________________
Excluded Scan Folders
etc dev proc tmp mnt media srv .snapshots
___________________________________________
Date Time Stamp
'+%Y-%m-%d %I:%M%P'
___________________________________________
EOL
fi
#setup configuration lines into array
IFS=$'
' read -d '' -r -a lines < /var/log/VirusVault/scanvirus.cfg
printf "excluded folders: %s
" "${lines[3]}"
printf "date time stamp : %s
" "${lines[6]}"
#DTS_tmp="${lines[6]}"
Date_Time_Stamp=$(date "${lines[6]}")
#printf -v Date_Time_Stamp "%s" "$(date "${lines[6]}")"
printf "%s
" "$Date_Time_Stamp"
cfg file unchanged
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
date: invalid date ‘’+%Y-%m-%d %I:%M%P’’
change this line:
‘+%Y-%m-%d_%I:%M%P’
same results
return original line in file
‘+%Y-%m-%d %I:%M%P’
Change:
Date_Time_Stamp=date '+%Y-%m-%d %I:%M%P'
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
2020-04-24 09:49pm
Change
Date_Time_Stamp=$(date ‘+%Y-%m-%d %I:%M%P’)
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
2020-04-24 09:49pm
Change
Date_Time_Stamp=$(date ("${lines[6]}"))
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
./scanvirusa: command substitution: line 137: syntax error near unexpected token "${lines[6]}"' ./scanvirusa: command substitution: line 137:
date ("${lines[6]}"))’
Change
Date_Time_Stamp="$(date “${lines[6]}”)"
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
date: invalid date ‘’+%Y-%m-%d %I:%M%P’’
Change
DTS_tmp="${lines[6]}"
Date_Time_Stamp=$(date “$DTS_tmp”)
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
date: invalid date ‘’+%Y-%m-%d %I:%M%P’’
Change
DTS_tmp="${lines[6]}"
printf "%s
" “$DTS_tmp”
Date_Time_Stamp=$(date “$DTS_tmp”)
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
‘+%Y-%m-%d %I:%M%P’
date: invalid date ‘’+%Y-%m-%d %I:%M%P’’
Change
Date_Time_Stamp=date ("${lines[6]}")
excluded folders: etc dev proc tmp mnt media srv .snapshots
date time stamp : ‘+%Y-%m-%d %I:%M%P’
./scanvirusa: command substitution: line 137: syntax error near unexpected token "${lines[6]}"' ./scanvirusa: command substitution: line 137:
date ("${lines[6]}")’