GNU bug report logs -
#24215
command=`rm`: how to script responses?
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[footnotes after .sig]
I am learning how to script `parted`, successfully insofar as the following scriptlet WFM[1]:
ORIG_DRIVE_LABEL='D078BBB478BB97A4'
ORIG_DRIVE_MOUNTPATH="/media/$(whoami)/${ORIG_DRIVE_LABEL}"
DRIVE_DEV='/dev/sdb'
date
du -hs "${ORIG_DRIVE_MOUNTPATH}"
df -h "${ORIG_DRIVE_MOUNTPATH}"
sudo parted ${DRIVE_DEV} --script -- print
# note following fails without specified ${DRIVE_DEV} ?!?
sudo parted ${DRIVE_DEV} --script -- print devices
However I am unable to avoid--or, better yet, to script so as to satisfy--prompts from
$ sudo parted ${DRIVE_DEV} --script -- rm 1
> Warning: Partition /dev/sdb1 is being used. Are you sure you want to continue?
This seems wrong to me, in 2 ways:
1. The manual[2] says quite clearly
> ‘-s’
> ‘--script’
> never prompt the user
So ISTM[3] either something is wrong with the code or with the manual. Am I missing something?
2. I can't find a way to script a response to the prompt. I have tried various permutations of
echo 'yes' | sudo parted ${DRIVE_DEV} --script -- rm 1
yes | sudo parted ${DRIVE_DEV} --script -- rm 1
yes Y | sudo parted ${DRIVE_DEV} --script -- rm 1
sudo sh -c "yes yes | sudo parted ${DRIVE_DEV} --script -- rm 1"
So ISTM one of 2 cases applies here:
1. `rm` is (deliberately) unscriptable. If so, ISTM this should be duly noted in the manual, e.g. here[4]
2. `rm` is scriptable, or the user needs to make some configuration change if s/he wants to script `rm`. If so, how? and again, the necessary instructions should also be provided in the manual (same place[4]), since it's obviously non-trivial.
In case it matters, I'm running Debian 8 with up-to-date (for that distro) `bash` and `parted`, particularly
$ date; sudo parted --version | head -1
> Fri Aug 12 15:42:45 MST 2016
> parted (GNU parted) 3.2
TIA, Tom Roche <Tom_Roche <at> pobox.com>
[1]: https://en.wiktionary.org/wiki/WFM
[2]: https://www.gnu.org/software/parted/manual/parted.html#Invoking-Parted
[3]: https://en.wiktionary.org/wiki/ISTM
[4]: https://www.gnu.org/software/parted/manual/parted.html#rm
This bug report was last modified 5 years and 162 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.