Bash

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m
m
Line 1: Line 1:
 
==Useful Arguments==
 
==Useful Arguments==
 
{|
 
{|
| -e || treat any non-zero return as an error, and quit
+
| <cpde>-e</code> || treat any non-zero return as an error, and quit
 
|-
 
|-
| -u || treat any use of an unset variable as an error, and quit
+
| <code>-u</code> || treat any use of an unset variable as an error, and quit
 
|}
 
|}
 +
 +
===example===
 +
<source lang="bash">
 +
#!/bin/bash -eu
 +
 +
echo "hi"
 +
false
 +
echo "there"
 +
</source>
  
 
==Command Not Found==
 
==Command Not Found==

Revision as of 22:07, 30 March 2012

Useful Arguments

<cpde>-e</code> treat any non-zero return as an error, and quit
-u treat any use of an unset variable as an error, and quit

example

#!/bin/bash -eu
 
echo "hi"
false
echo "there"

Command Not Found

function command_not_found_handle {
  echo "Hello"
  return 127
}
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox