Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
BASH
(view source)
Revision as of 01:54, 27 March 2015
39 bytes removed
,
01:54, 27 March 2015
no edit summary
Line 1:
Line 1:
−
==
BASH
Script ==
+
'''
BASH
Scripting'''
−
=
== Hello World
=
==
+
== Hello World ==
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 7:
Line 7:
</source>
</source>
−
=
== Variables
=
==
+
== Variables ==
−
=
=== Local Variables
=
===
+
=== Local Variables ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 20:
Line 20:
echo $HELLO
echo $HELLO
</source>
</source>
−
=
=== Boolean
=
===
+
=== Boolean ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 30:
Line 30:
</source>
</source>
−
=
== Strings
=
==
+
== Strings ==
−
=
== Loops
=
==
+
== Loops ==
−
=
=== While
=
===
+
=== While ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 42:
Line 42:
</source>
</source>
−
=
=== For
=
===
+
=== For ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 49:
Line 49:
done
done
</source>
</source>
−
=
=== C-like for
=
===
+
=== C-like for ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 57:
Line 57:
done
done
</source>
</source>
−
=
=== Until
=
===
+
=== Until ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 67:
Line 67:
</source>
</source>
−
=
== Conditional
=
==
+
== Conditional ==
−
=
=== if
=
===
+
=== if ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 80:
Line 80:
</source>
</source>
−
=
=== case
=
===
+
=== case ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 90:
Line 90:
</source>
</source>
−
=
== User Input
=
==
+
== User Input ==
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 103:
Line 103:
</source>
</source>
−
=
== Arrays
=
==
+
== Arrays ==
<source lang="bash">
<source lang="bash">
ARRAY=(one two three)
ARRAY=(one two three)
Line 122:
Line 122:
</source>
</source>
−
=
== Functions
=
==
+
== Functions ==
<source lang="bash">
<source lang="bash">
function quit {
function quit {
Line 135:
Line 135:
echo foo
echo foo
</source>
</source>
−
=
== extras
=
==
+
== extras ==
−
=
=== Check if a package is installed
=
===
+
=== Check if a package is installed ===
<source lang="bash">
<source lang="bash">
#!/bin/sh
#!/bin/sh
Line 145:
Line 145:
debInst terminator
debInst terminator
</source>
</source>
−
=
=== Check if a file exists
=
===
+
=== Check if a file exists ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 162:
Line 162:
</source>
</source>
−
=
=== Check user
=
===
+
=== Check user ===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 175:
Line 175:
fi
fi
</source>
</source>
−
=
=== Execute localScript on remote server
=
===
+
=== Execute localScript on remote server ===
<nowiki>ssh [user]@[server] 'bash -s' < [local_script]</nowiki>
<nowiki>ssh [user]@[server] 'bash -s' < [local_script]</nowiki>
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version