mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-22 08:41:50 +02:00
Update changeidenfication.sh
This commit is contained in:
@@ -24,20 +24,20 @@ if ! grep -q "$NEWNAME" "$LABELS_FILE"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract the part before the _ from $NEWNAME
|
|
||||||
NEWNAME_comname="${NEWNAME#*_}"
|
|
||||||
NEWNAME_sciname="${NEWNAME%%_*}"
|
|
||||||
|
|
||||||
# Get the line where the column "File_Name" matches exactly $OLDNAME
|
# Get the line where the column "File_Name" matches exactly $OLDNAME
|
||||||
IFS='|' read -r OLDNAME_sciname OLDNAME_comname OLDNAME_date < <(sqlite3 "$DB_FILE" "SELECT Sci_Name, Com_Name, Date FROM $DETECTIONS_TABLE WHERE File_Name = '$OLDNAME';")
|
IFS='|' read -r OLDNAME_sciname OLDNAME_comname OLDNAME_date < <(sqlite3 "$DB_FILE" "SELECT Sci_Name, Com_Name, Date FROM $DETECTIONS_TABLE WHERE File_Name = '$OLDNAME';")
|
||||||
|
|
||||||
echo "This script will change the identification $OLDNAME from $OLDNAME_comname to $NEWNAME_comname"
|
|
||||||
|
|
||||||
if [[ -z "$OLDNAME_sciname" ]]; then
|
if [[ -z "$OLDNAME_sciname" ]]; then
|
||||||
echo "Error: No line matching $OLDNAME in $DB_FILE"
|
echo "Error: No line matching $OLDNAME in $DB_FILE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "This script will change the identification $OLDNAME from $OLDNAME_comname to $NEWNAME_comname"
|
||||||
|
|
||||||
|
# Extract the part before the _ from $NEWNAME
|
||||||
|
NEWNAME_comname="${NEWNAME#*_}"
|
||||||
|
NEWNAME_sciname="${NEWNAME%%_*}"
|
||||||
|
|
||||||
# Replace spaces with underscores
|
# Replace spaces with underscores
|
||||||
NEWNAME_comname2="${NEWNAME_comname// /_}"
|
NEWNAME_comname2="${NEWNAME_comname// /_}"
|
||||||
OLDNAME_comname2="${OLDNAME_comname// /_}"
|
OLDNAME_comname2="${OLDNAME_comname// /_}"
|
||||||
|
|||||||
Reference in New Issue
Block a user