Above post moved here.The command interpreter for this script is bourne shell #!/bin/sh. Ubuntu links /bin/sh to dash. Echo is used in this script and since there is no exectuable set for echo the builtin is used.
The echo built-in command for the dash interpreter does not have provision for the -e flag. Thus - e gets piped to fdisk during for drive partitioning statements and drive fails to be partitioned correctly.
Statements such as the bellow fail because "-" and "e" get piped to fdisk instead of just o w and n. Also the carriage returns are not sent either since the -e flag is not valid for the dash built-in echo.
echo -e 'o\nw\n' | fdisk /dev/${TARGETDRIVE} > /tmp/installquirkyfdisk.log 2>&1
two simple fixes are to use /bin/echo or just change the command interpreter to bash which seems to be the easiest fix for this problem. Script runs successfully in Ubuntu 14.04 LTS xterm using #!/bin/bash for command interpreter.
-Linuxbass
Ok, I have put this into the script:
ECHOEXE="$(which echo)" #141103 use external echo.
And used:
${ECHOEXE} -e ....
Rather than using bash.
Note, cannot assume path is /bin/echo anymore.
[/quote]