Fixed conversion for password with escape character using TAB delimiter

This commit is contained in:
Claudio Maradonna 2021-03-17 11:38:47 +01:00
parent 266861d2b0
commit 314b3795de
Signed by: claudiomaradonna
GPG key ID: B1EDCB4C3B05C387

View file

@ -15,13 +15,14 @@ fi
BASE_NAME=passwords
CURRENT_DATE=$(date "+%Y-%m-%d")
FINAL_FILE_NAME=${BASE_NAME}_${CURRENT_DATE}.csv
DELIMITER=$'\t'
if [[ -f "$FINAL_FILE_NAME" ]]; then
echo "A file with name $FINAL_FILE_NAME already exists! Please rename or delete and re-execute this script."
exit
else
touch $FINAL_FILE_NAME
echo "\"Account\";\"Password\";\"Login\"" >> $FINAL_FILE_NAME
echo "Account${DELIMITER}Password${DELIMITER}Login" >> $FINAL_FILE_NAME
fi
if [[ -f "$FINAL_FILE_NAME" ]]; then
@ -36,7 +37,7 @@ if [[ -f "$FINAL_FILE_NAME" ]]; then
GPG_FILE_NAME=${GPG_FILE_NAME//\// > }
echo "Processing ${GPG_FILE_NAME}";
echo "\"$GPG_FILE_NAME\";\"$PASSWORD\";\"$LOGIN_KEY\"" >> $FINAL_FILE_NAME
echo "$GPG_FILE_NAME$DELIMITER$PASSWORD$DELIMITER$LOGIN_KEY" >> $FINAL_FILE_NAME
}; done;
unset f;