#18 Update modules/ROOT/pages/programming-languages/Shell.adoc
Merged 2 years ago by huzaifas. Opened 2 years ago by tguittet.
tguittet/defensive-coding-guide master  into  master

@@ -226,7 +226,7 @@ 

  See <<sect-Defensive_Coding-Shell-Arithmetic>>.

  

  Shell scripts which use integer or array variables should be

- rewritten in another, more suitable language. Se <<sect-Defensive_Coding-Shell-Alternatives>>.

+ rewritten in another, more suitable language. See <<sect-Defensive_Coding-Shell-Alternatives>>.

  

  [[sect-Defensive_Coding-Shell-Obscure]]

  === Other Obscurities
@@ -291,6 +291,7 @@ 

  (“pass:attributes[{blank}]`command1 | command2`pass:attributes[{blank}]”) are only detected for the

  last command in the pipe, errors in previous commands are ignored.

  This can be changed by invoking “pass:attributes[{blank}]`set -o pipefail`pass:attributes[{blank}]”.

+ Alternatively, return codes for previous commands in pipes can be accessed in the (“pass:attributes[{blank}]`${PIPESTATUS[X]}`pass:attributes[{blank}]”) array.

  Due to architectural limitations, only the process that spawned

  the entire pipe can check for failures in individual commands;

  it is not possible for a process to tell if the process feeding

Fix typo and add PIPESTATUS for checking return values of commands executed within pipes.

Pull-Request has been merged by huzaifas

2 years ago
Metadata