Bash: Difference between revisions
From charlesreid1
(→Tricks) |
No edit summary |
||
| Line 4: | Line 4: | ||
== Dot Files == | == Dot Files == | ||
= Tricks = | = Tricks = | ||
| Line 20: | Line 22: | ||
== Math == | == 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/ | |||
Revision as of 09:07, 4 October 2010
Bash Guide
Startup Process
Dot Files
Tricks
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/