<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cory O&#039;Daniel - These are just words &#187; linux</title>
	<atom:link href="http://coryodaniel.com/index.php/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://coryodaniel.com</link>
	<description>Software development, thoughts, and randomness</description>
	<lastBuildDate>Sat, 31 Jul 2010 00:04:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Stick this in your bash</title>
		<link>http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/</link>
		<comments>http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 04:23:50 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[prompt]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=449</guid>
		<description><![CDATA[This isn't a tutorial or anything. Its merely just me dropping all my bash scripts/prompt stuff here so maybe I'll get some comments/tips on cool stuff to add, and so that I can always rip it if I'm on a remote computer.
My pride and joy is that bash prompt. So much info. Its a pretty [...]]]></description>
			<content:encoded><![CDATA[<p>This isn't a tutorial or anything. Its merely just me dropping all my bash scripts/prompt stuff here so maybe I'll get some comments/tips on cool stuff to add, and so that I can always rip it if I'm on a remote computer.</p>
<p>My pride and joy is that bash prompt. So much info. Its a pretty cool bash prompt if I do say so myself (toot toot) <img src='http://coryodaniel.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
Username@Host<br />
List of IP Addresses<br />
Number of files in the directory<br />
Current Path<br />
History Command Number<br />
Git Branch (if a git repo)<br />
<a href="http://coryodaniel.com/wp-content/uploads/2010/02/bashprompt.jpg"><img src="http://coryodaniel.com/wp-content/uploads/2010/02/bashprompt.jpg" alt="Nerd-ass prompt" title="bashprompt" width="581" height="497" class="aligncenter size-full wp-image-452" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ~/.bash_login</span>
<span style="color: #666666; font-style: italic;"># Shell Options</span>
<span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> checkwinsize
<span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> cdspell
&nbsp;
<span style="color: #666666; font-style: italic;"># Exports</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">EDITOR</span>=<span style="color: #ff0000;">&quot;mate -w&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">VISUAL</span>=<span style="color: #ff0000;">&quot;mate -w&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTFILESIZE</span>=<span style="color: #000000;">3000</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTCONTROL</span>=ignoredups
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DISPLAY</span>=:<span style="color: #000000;">0.0</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GEM_PATH</span>=<span style="color: #ff0000;">&quot;/Library/Ruby/Gems/1.8/gems&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=~<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>bin:~<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>flex_sdk_3<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># include functions, aliases &amp; bashrc</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.functions <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  . ~<span style="color: #000000; font-weight: bold;">/</span>.functions;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.aliases <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  . ~<span style="color: #000000; font-weight: bold;">/</span>.aliases;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  . ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_prompt <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  . ~<span style="color: #000000; font-weight: bold;">/</span>.bash_prompt;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>bash_completion <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  .  <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>bash_completion
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">complete</span> <span style="color: #660033;">-C</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_completion.d<span style="color: #000000; font-weight: bold;">/</span>rake <span style="color: #660033;">-o</span> default rake
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">date</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>fortune <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>fortune <span style="color: #660033;">-s</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ~/.bash_prompt</span>
<span style="color: #666666; font-style: italic;"># Define a few Color's</span>
<span style="color: #007800;">BLACK</span>=<span style="color: #ff0000;">'\[\e[0;30m\]'</span>
<span style="color: #007800;">BLUE</span>=<span style="color: #ff0000;">'\[\e[0;34m\]'</span>
<span style="color: #007800;">GREEN</span>=<span style="color: #ff0000;">'\[\e[0;32m\]'</span>
<span style="color: #007800;">CYAN</span>=<span style="color: #ff0000;">'\[\e[0;36m\]'</span>
<span style="color: #007800;">RED</span>=<span style="color: #ff0000;">'\[\e[0;31m\]'</span>
<span style="color: #007800;">PURPLE</span>=<span style="color: #ff0000;">'\[\e[0;35m\]'</span>
<span style="color: #007800;">BROWN</span>=<span style="color: #ff0000;">'\[\e[0;33m\]'</span>
<span style="color: #007800;">LIGHTGRAY</span>=<span style="color: #ff0000;">'\[\e[0;37m\]'</span>
<span style="color: #007800;">DARKGRAY</span>=<span style="color: #ff0000;">'\[\e[1;30m\]'</span>
<span style="color: #007800;">LIGHTBLUE</span>=<span style="color: #ff0000;">'\[\e[1;34m\]'</span>
<span style="color: #007800;">LIGHTGREEN</span>=<span style="color: #ff0000;">'\[\e[1;32m\]'</span>
<span style="color: #007800;">LIGHTCYAN</span>=<span style="color: #ff0000;">'\[\e[1;36m\]'</span>
<span style="color: #007800;">LIGHTRED</span>=<span style="color: #ff0000;">'\[\e[1;31m\]'</span>
<span style="color: #007800;">LIGHTPURPLE</span>=<span style="color: #ff0000;">'\[\e[1;35m\]'</span>
<span style="color: #007800;">YELLOW</span>=<span style="color: #ff0000;">'\[\e[1;33m\]'</span>
<span style="color: #007800;">WHITE</span>=<span style="color: #ff0000;">'\[\e[0;37m\]'</span>
<span style="color: #007800;">NC</span>=<span style="color: #ff0000;">'\[\e[0m\]'</span>              <span style="color: #666666; font-style: italic;"># No Color</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> drpmpt <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">first_prompt_line</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$WHITE</span>(<span style="color: #007800;">$CYAN</span>\u@\h<span style="color: #007800;">$WHITE</span>)-(<span style="color: #007800;">$CYAN</span><span style="color: #007800;">$(ip)</span><span style="color: #007800;">$WHITE</span>)-&gt;&quot;</span>
  <span style="color: #007800;">second_prompt_line</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$WHITE</span>(<span style="color: #007800;">$CYAN</span><span style="color: #007800;">$(ls -1|wc -l|tr -d &quot;[:blank:]&quot;)</span> files<span style="color: #007800;">$WHITE</span>)-(<span style="color: #007800;">$CYAN</span>\w<span style="color: #007800;">$WHITE</span>)-&gt;&quot;</span>
  <span style="color: #007800;">third_prompt_line</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$WHITE</span>(<span style="color: #007800;">$GREEN</span>!\!<span style="color: #007800;">$WHITE</span>)<span style="color: #007800;">$GREEN</span><span style="color: #007800;">$(parse_git_branch)</span><span style="color: #007800;">$WHITE</span>&quot;</span>
  <span style="color: #007800;">working_prompt</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$first_prompt_line</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">$second_prompt_line</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">$third_prompt_line</span>&gt; <span style="color: #007800;">$NC</span>&quot;</span>
&nbsp;
  <span style="color: #007800;">PS1</span>=<span style="color: #007800;">$working_prompt</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">PROMPT_COMMAND</span>=drpmpt</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ~/.aliases</span>
<span style="color: #666666; font-style: italic;"># TO BYPASS AN ALIAS DO THE ORIGINAL COMMAND W \, ie \ls</span>
<span style="color: #666666; font-style: italic;"># Aliases</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">pastie</span>=<span style="color: #ff0000;">'sake pastie:clip'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> ..=<span style="color: #ff0000;">'cd ..'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">igem</span>=<span style="color: #ff0000;">'sudo gem install --no-rdoc --no-ri'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">c</span>=<span style="color: #ff0000;">'clear'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">dsrm</span>=<span style="color: #ff0000;">&quot;find . -type f -name .DS_Store -print0 | xargs -0 rm&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">gcpp</span>=<span style="color: #ff0000;">'dsrm; git commit .; git pull; git push'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">sha1sum</span>=<span style="color: #ff0000;">'openssl sha1'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lgem</span>=<span style="color: #ff0000;">'gem install --no-rdoc --no-ri -i ./gems --ignore-dependencies'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">start_wowza</span>=<span style="color: #ff0000;">'/Library/WowzaMediaServerPro/bin/startup.sh'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">stop_wowza</span>=<span style="color: #ff0000;">'/Library/WowzaMediaServerPro/bin/shutdown.sh'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">hist</span>=<span style="color: #ff0000;">'history | grep $1'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">ps</span></span>=<span style="color: #ff0000;">'ps aux'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">home</span>=<span style="color: #ff0000;">'cd ~'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">utgz</span>=<span style="color: #ff0000;">'tar -zxvf'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">tgz</span>=<span style="color: #ff0000;">'tar -zcvf'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">mnts</span>=<span style="color: #ff0000;">'df -h'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Alias to multiple ls commands</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">la</span>=<span style="color: #ff0000;">'ls -Al'</span>               <span style="color: #666666; font-style: italic;"># show hidden files</span>
<span style="color: #666666; font-style: italic;">#alias ls='ls -aF ' # add colors and file type extensions</span>
<span style="color: #666666; font-style: italic;">#alias lx='ls -lXB'              # sort by extension</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lk</span>=<span style="color: #ff0000;">'ls -lSr'</span>              <span style="color: #666666; font-style: italic;"># sort by size</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lc</span>=<span style="color: #ff0000;">'ls -lcr'</span>          <span style="color: #666666; font-style: italic;"># sort by change time</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lu</span>=<span style="color: #ff0000;">'ls -lur'</span>          <span style="color: #666666; font-style: italic;"># sort by access time</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lr</span>=<span style="color: #ff0000;">'ls -lR'</span>               <span style="color: #666666; font-style: italic;"># recursive ls</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lt</span>=<span style="color: #ff0000;">'ls -ltr'</span>              <span style="color: #666666; font-style: italic;"># sort by date</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">lm</span>=<span style="color: #ff0000;">'ls -al |more'</span>         <span style="color: #666666; font-style: italic;"># pipe through 'more'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Alias chmod commands</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">mx</span>=<span style="color: #ff0000;">'chmod a+x'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> 000=<span style="color: #ff0000;">'chmod 000'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #000000;">644</span>=<span style="color: #ff0000;">'chmod 644'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #000000;">755</span>=<span style="color: #ff0000;">'chmod 755'</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ~/.functions</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Parse git branch</span>
parse_git_branch<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  git branch <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'/^[^*]/d'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/* \(.*\)/ [\1]/'</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Get assigned ip address</span>
ip<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">OS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">uname</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$OS</span> <span style="color: #000000; font-weight: bold;">in</span>
   Linux<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">IP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ifconfig</span>  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'inet addr:'</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'127.0.0.1'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -d: <span style="color: #660033;">-f2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1}'</span><span style="color: #000000; font-weight: bold;">`;;</span>
   FreeBSD<span style="color: #000000; font-weight: bold;">|</span>OpenBSD<span style="color: #000000; font-weight: bold;">|</span>Darwin<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">IP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ifconfig</span>  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-E</span> <span style="color: #ff0000;">'inet.[0-9]'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'127.0.0.1'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $2}'</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">;;</span>
   SunOS<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">IP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> inet <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'127.0.0.1'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $2} '</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">;;</span>
   <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">IP</span>=<span style="color: #ff0000;">&quot;Unknown&quot;</span><span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Remove new lines and trailing whitespace.</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$IP</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ printf &quot;%s | &quot;, $0 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ sub(/(\ \|\ )$/, &quot;&quot;); print}'</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Determine if an app is running</span>
list<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #c20cb9; font-weight: bold;">ps</span> aux <span style="color: #660033;">-m</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> $<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
git_prompt_ip<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_PROMPT_IP</span>=$<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p align="left"><a class="tt" href="http://twitter.com/home/?status=Stick+this+in+your+bash+http://bit.ly/bRj5LR" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/&amp;title=Stick+this+in+your+bash" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/&amp;t=Stick+this+in+your+bash" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/&amp;title=Stick+this+in+your+bash" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/&amp;title=Stick+this+in+your+bash" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2010/02/08/stick-this-in-your-bash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
