i am trying to learn bash and now im trying to do a script for burning isos. I made the number "4" command to make sure the variables were right.

the message i get when i complete my program and execute dd i.e command nr 5

./burn2.sh: line 39: /home/anon/dotsh/sudo dd if=/home/anon/Downloads/OS/Windows/Win10homepro/Win10.iso of=/dev/sdb1 bs=1M: No such file or directory

The script contains:

#set -vx
while true
    echo "============================="
    echo "    Burning menu using dd    "
    echo "============================="
    echo "Enter 1 for full path to iso."
    echo "Enter 2 for media"
    echo "Enter 3 to set bs speed 512K default"
    echo "Enter 4 to save to files"
    echo "Enter 5 to execute dd command"
    echo "Enter q to exit q:"
    echo -e "\n"
    echo -e "Enter your choice \c"
    read -r choice
    case "$choice" in
        q) exit ;;
        1) echo -e "Enter path to iso \c"
           read -r iso ;;
        2) echo -e "Enter device"
           read -r device ;;
        3) echo -e "Enter bs speed \c"
           read -r speed ;;
        4) echo "$iso" > $iso_file
            echo "$device" > $dev_file
            echo "$speed" > $speed_file ;;
        5) echo -e "Going to format $device, are you sure (y/N?) \c"
            read -r $ans
        if [[ "$ans" != "y" && "$ans" != "Y" ]]; then
            echo "Clearing screen"
            sleep 2
            exec "sudo dd if=$iso of=/dev/$device bs=$speed"
            echo "Burning done!"
            sleep 3
  • 2
    Try to change the line: exec "sudo dd if=$iso of=/dev/$device bs=$speed" with this one: sudo /bin/dd if=$iso of=/dev/$device bs=$speed – dervishe Mar 7 '16 at 6:43
  • Have you tried to run the command in line 39 from CLI to see if it runs successfully? i.e., to check whether ISO file and device nodes are correct. – dr01 Mar 7 '16 at 8:55
  • Off Topic: Does this work? Can you just dd an iso onto e.g. /dev/cdrw and it will actually write data onto a CD-R and the result is a readable CD-ROM? – Bananguin Mar 7 '16 at 10:45
  • @Bananguin no it doesn't work – roaima Oct 5 '17 at 23:06
exec "sudo dd if=$iso of=/dev/$device bs=$speed"

This would try to replace the current shell with the command called "..." (i.e., the whole string is the name of the command). This command does not exist, which is why you get the No such file or directory error message.

I don't quite see why you would want to use exec here, especially since you have further commands to execute after it (exec never returns).

Instead, just call sudo as normal:

sudo dd if="$iso" of="/dev/$device" bs="$speed"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.