On Fri, 2014-08-01 at 15:58 +0200, Thomas Neumann wrote: [...] > SWAPLIST=${SWAPLIST:-"/dev/sda2"} > BOOT_DEVICE=${BOOT_DEVICE:-"/dev/sda"} > ROOT_PARTITION=${ROOT_PARTITION:-/dev/sda1} > BOOT_PARTITION=${BOOT_PARTITION:-/dev/sda1} > > (Same output for setup_storage 1.5 and 1.6.) > > Sourcing the file and printing the variables does indeed yield the expected > values. > > a) can someone confirm his setup_storage generates the same strange values?
still using setup-storage 1.3, doesn't generate that output. > b) can someone explain what kind of bash trickery is going on here? it's returning default values for the variables if they're unset/empty. the ${PARAMETER:-WORD} syntax says "if PARAMETER is unset or empty, return WORD." note that there is a difference between ":-" and ":=", and that the latter might be better in this case. the shorter ${PARAMETER:=WORD} would assign the value of WORD to PARAMETER in the unset/empty case. in my head ":-" is for returning defaults, ":=" is for assigning them. but please correct me if i'm off-base, as i've only recently grokked the difference. ex: $ unset MYVAR $ echo "${MYVAR:-test}" test $ echo $MYVAR <- intentionally empty lines $ ${MYVAR:-test} | $ echo $MYVAR | <- $ ${MYVAR:=test} $ echo $MYVAR test see the "Parameter Expansion" portion of BASH(1) or http://wiki.bash-hackers.org/syntax/pe for add'l info hth andy -- andrew bezella <abeze...@archive.org> Internet Archive