Bash: Difference between revisions
From charlesreid1
(Created page with "= Bash Guide = == Startup Process == == Dot Files == = Tricks = == Math ==") |
(→Tricks) |
||
| Line 6: | Line 6: | ||
= Tricks = | = 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: | |||
<syntaxhighlight lang="bash"> | |||
for i in `/bin/ls -1 $HOME`; do | |||
echo $i | |||
done | |||
</syntaxhighlight> | |||
== Math == | == Math == | ||
Revision as of 08:44, 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