[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shell kung-fu with set -e, return codes and i/o redirection in while read ... loop



On 20/07/2009 Boyd Stephen Smith Jr. wrote:
> In <[🔎] 20090719235708.GB22995@resivo.wgnet.de>, Jonas Meurer wrote:
> >- in cryptdisks_{start|stop} only one device is setup anyway. here I
> >  simply don't use set -e and check for the error code instead.
> 
> While I understand your goal here, I think you should try and accomplish it 
> while leaving the entire script "set -e".  It helps prevent errors from 
> cascading.  Even if you are checking return values for everything now, you 
> might not be so disciplined with changes in the future.

i see your point and indeed i already reverted the change to not set -e
the scripts. instead I now use a if statement for the invokation of
handle_crypttab_line_{start,stop}, do post-cryptsetup stuff (umount)
directly in the while loop, and exit with log_action_end_msg $ret at the
end of the while loop. that way the script always stops inside the while
loop, with or without error.

greetings,
 jonas

Attachment: signature.asc
Description: Digital signature


Reply to: