1

I have a script process.csh for processing many files through many steps which the above output is the input of below command. Do I need to insert a delay between commands to be sure there is no potential error of the process in reality ?

sed -i.bak -e '1488,2627d' FF_3p63_0p99_m040c.lib    
sed -i.bak -e '1488,2627d' FF_3p63_0p99_p125c.lib
sed -i.bak -e '1488,2627d' SS_2p97_0p81_m040c.lib
sed -i.bak -e '1488,2627d' SS_2p97_0p81_p125c.lib
sed -i.bak -e '1488,2627d' TT_3p30_0p90_p025c.lib
sed -n '2716,3855p' FF_3p63_0p99_m040c.lib.bak | sed 's/_V/_H/g' > FF_3p63_0p99_m040c.split                                                                             
sed -n '2716,3855p' FF_3p63_0p99_p125c.lib.bak | sed 's/_V/_H/g' > FF_3p63_0p99_p125c.split
sed -n '2716,3855p' SS_2p97_0p81_m040c.lib.bak | sed 's/_V/_H/g' > SS_2p97_0p81_m040c.split
sed -n '2716,3855p' SS_2p97_0p81_p125c.lib.bak | sed 's/_V/_H/g' > SS_2p97_0p81_p125c.split
sed -n '2716,3855p' TT_3p30_0p90_p025c.lib.bak | sed 's/_V/_H/g' > TT_3p30_0p90_p025c.split
sed '1487r FF_3p63_0p99_m040c.split' FF_3p63_0p99_m040c.lib > ./temp/FF_3p63_0p99_m040c.lib
sed '1487r FF_3p63_0p99_p125c.split' FF_3p63_0p99_p125c.lib > ./temp/FF_3p63_0p99_p125c.lib
sed '1487r SS_2p97_0p81_m040c.split' SS_2p97_0p81_m040c.lib > ./temp/SS_2p97_0p81_m040c.lib
sed '1487r SS_2p97_0p81_p125c.split' SS_2p97_0p81_p125c.lib > ./temp/SS_2p97_0p81_p125c.lib
sed '1487r TT_3p30_0p90_p025c.split' TT_3p30_0p90_p025c.lib > ./temp/TT_3p30_0p90_p025c.lib
2

No, there’s no need to insert delays, they won’t have any effect on potential errors.

You should however check for errors — the simplest way to do so on current systems is to add

set -e

at the start of your script. See David Pashley’s guide to writing robust shell scripts. Note however that set -e isn’t a panacea, there are subtle differences in behaviour depending on the shell you’re using.

  • There's a hint in the question that this is csh. Would set -e apply? – glenn jackman Jun 8 '18 at 15:28
  • @glenn silly me, indeed, it wouldn’t. Is there a csh equivalent? – Stephen Kitt Jun 8 '18 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.