Difference between revisions of "BASH"

From RHS Wiki
Jump to navigation Jump to search
Line 8: Line 8:
  
 
=== Variables ===
 
=== Variables ===
 +
==== Local Variables ====
 +
<source lang="bash">
 +
#!/bin/bash
 +
HELLO=Hello
 +
function hello {
 +
        local HELLO=World
 +
        echo $HELLO
 +
}
 +
echo $HELLO
 +
hello
 +
echo $HELLO
 +
</source>
 +
 
=== Strings ===
 
=== Strings ===
 
=== Loops ===
 
=== Loops ===

Revision as of 00:51, 27 March 2015

BASH Script

Hello World

#!/bin/bash
STR="Hello World"
echo $STR

Variables

Local Variables

#!/bin/bash
HELLO=Hello 
function hello {
        local HELLO=World
        echo $HELLO
}
echo $HELLO
hello
echo $HELLO

Strings

Loops

While

For

Conditional

if

case

User Input

Arrays