La forma en que hago esto es:
[fredmj@Lagrange ~]$ vboxmanage list dvds
[...]
UUID: 3cc8e4fb-e56e-blabla...
State: created
Type: readonly
Location: /usr/share/virtualbox/VBoxGuestAdditions.iso
Storage format: RAW
Capacity: 55 MBytes
Encryption: disabled
para tomar el UUID y ponerlo en el comando vboxmanage:
[fredmj@Lagrange ~]$ vboxmanage storageattach CENTOS7.GUESTADD --storagectl SATA --port 1 --type dvddrive --medium 3cc8e4fb-e56e-blabla..
Leyendo el manual de usuario Pensé que era posible usar algo como --medium additions
pero no logré averiguar cómo
Если вам нужно, чтобы OPTERR был равен 0 во время вызова функции, установите его как локальную переменную, как указал Гордон Дэвиссон:
#!/bin/bash
myfunc() {
local OPTERR=0
printf "Inside myfunc, OPTERR=%d\n" "$OPTERR"
while getopts ":a:" opt; do
echo $opt is $OPTARG
done
}
printf "Before calling myfunc, OPTERR=%d\n" "$OPTERR"
myfunc
printf "After calling myfunc, OPTERR=%d\n" "$OPTERR"
Результат:
Before calling myfunc, OPTERR=1
Inside myfunc, OPTERR=0
After calling myfunc, OPTERR=1