Quantcast
Channel: Question and Answer » programming
Viewing all articles
Browse latest Browse all 103

BASH dd problem

$
0
0

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:

#!/bin/bash
#set -vx
speed=512K
iso_file="iso.txt"
dev_file="dev.txt"
speed_file="speed.txt"
while true
    do
    clear
    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
            clear
            exec "sudo dd if=$iso of=/dev/$device bs=$speed"
            echo "Burning done!"
            sleep 3
            exit
        fi
    esac
done

hope you can help, thanks in advance


Viewing all articles
Browse latest Browse all 103

Latest Images

Trending Articles



Latest Images