Bash: Difference between revisions
From charlesreid1
(→Tricks) |
|||
| Line 23: | Line 23: | ||
== Dot Files == | == Dot Files == | ||
= | = Bash Scripting = | ||
== Looping == | == Looping == | ||
| Line 38: | Line 38: | ||
== Math == | == Math == | ||
= References = | = References = | ||
Revision as of 22:35, 26 October 2010
Bash Guide
Using Bash
Setting the default shell: http://www.unix.com/shell-programming-scripting/32664-how-change-default-shell-linux.html
Startup Process
source /etc/profile
source ~/.profile
(source ~/.bash_profile?)
source /etc/bashrc
source ~/.bashrc
Dot Files
Bash Scripting
Looping
Looping in bash is really simple, and convenient - you can use other unix commands (most obviously "ls") to create lists, and then loop over each element of those lists. For example, if I want to print out the name of every file in my home directory (granted, not very useful, but this is just an example), I can do this:
for i in `/bin/ls -1 $HOME`; do
echo $i
done
Math
References
Floating point math in the shell:
http://www.novell.com/coolsolutions/tools/17043.html
Fast bash math:
http://www.bytemycode.com/snippets/snippet/350/
Bash script iterate through array of values
http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/