Has anybody use ChatGPT for programming? I think it would very very handy (less bugs) and less questions on the mailing-list
I had a bash script to copy file from usb to HD
--------
if mount | grep -q '/run/media/fd/KIOXIA'; then
rsync -av /run/media/fd/KIOXIA/SCILOG/ /home/thelma/business/backup/SCILOG/
else
echo "disk not mounted"
fi
-------
I asked ChatGPT to rewrite me the script utilizing zenity to show progress bar on a desktop, here is what I got:
------
!/bin/sh
if mount | grep -q '/run/media/fd/KIOXIA'; then
zenity --progress --title="Backup Progress" --text="Backing up files..." --auto-close --auto-kill --pulsate &
PID=$!
rsync -av --info=progress2 /run/media/fd/KIOXIA/SCILOG/ /home/thelma/business/backup/SCILOG/ | while read line; do
if [[ $line == *%* ]]; then
percent=$(echo $line | awk '{print $2}' | tr -d '%')
echo $percent
echo "# Backing up files: $percent%"
echo $percent | zenity --progress --title="Backup Progress" --text="Backing up files..." --auto-close --auto-kill --percentage=$(cat) &
fi
done
wait $PID
zenity --info --title="Backup Completed" --text="Backup has completed successfully." --timeout=5
else
zenity --error --title="Error" --text="Disk not mounted."
fi
-----------
PS. I think I will try to utilize ChatGPT to upgrade my old osCommerce from php 7.4 to php 8
It will not be easy but I'll try.
I had a bash script to copy file from usb to HD
--------
if mount | grep -q '/run/media/fd/KIOXIA'; then
rsync -av /run/media/fd/KIOXIA/SCILOG/ /home/thelma/business/backup/SCILOG/
else
echo "disk not mounted"
fi
-------
I asked ChatGPT to rewrite me the script utilizing zenity to show progress bar on a desktop, here is what I got:
------
!/bin/sh
if mount | grep -q '/run/media/fd/KIOXIA'; then
zenity --progress --title="Backup Progress" --text="Backing up files..." --auto-close --auto-kill --pulsate &
PID=$!
rsync -av --info=progress2 /run/media/fd/KIOXIA/SCILOG/ /home/thelma/business/backup/SCILOG/ | while read line; do
if [[ $line == *%* ]]; then
percent=$(echo $line | awk '{print $2}' | tr -d '%')
echo $percent
echo "# Backing up files: $percent%"
echo $percent | zenity --progress --title="Backup Progress" --text="Backing up files..." --auto-close --auto-kill --percentage=$(cat) &
fi
done
wait $PID
zenity --info --title="Backup Completed" --text="Backup has completed successfully." --timeout=5
else
zenity --error --title="Error" --text="Disk not mounted."
fi
-----------
PS. I think I will try to utilize ChatGPT to upgrade my old osCommerce from php 7.4 to php 8
It will not be easy but I'll try.