I single-stepped through a stock image-backup under bashdb. Everything makes sense until that line, and then the -f fails, as if the image file weren't there. But it IS there. Here's the output of the debugger starting when the image filename is about to be read, within the option parsing loop:
Code:
254:while [ $# -gt 0 ]; dobashdb<43> n(/home/pi/bin/image-backup:255):255: case "$1" inbashdb<44> n(/home/pi/bin/image-backup:299):299: IMGFILE="$1"bashdb<45> n(/home/pi/bin/image-backup:300):300: shiftbashdb<46> print IMGFILEIMGFILEbashdb<47> print $IMGFILE/mnt/backup/piz2-bookworm32.imgbashdb<48> n(/home/pi/bin/image-backup:254):254:while [ $# -gt 0 ]; dobashdb<49> n(/home/pi/bin/image-backup:305):305:if [ "${IMGFILE}" = "" ]; thenbashdb<50> n(/home/pi/bin/image-backup:521):521: if [[ ! "${IMGFILE}" =~ ^/mnt/.*$ && ! "${IMGFILE}" =~ ^/media/.*$ ]]; thenbashdb<51> n(/home/pi/bin/image-backup:524):524: if [ -d "${IMGFILE}" ]; thenbashdb<52> n(/home/pi/bin/image-backup:526):526: elif [ ! -f "${IMGFILE}" ]; thenbashdb<53> n(/home/pi/bin/image-backup:527):527: errexit "${IMGFILE} not found"bashdb<54> print ${IMGFILE}/mnt/backup/piz2-bookworm32.imgbashdb<55> n/mnt/backup/piz2-bookworm32.img not foundDebugged program terminated with code 1. Use q to quit or R to restart.bashdb<56>
Statistics: Posted by tinker2much — Tue Dec 31, 2024 6:33 pm