<?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>james young &#187; bash</title>
	<atom:link href="http://psyjinx.com/jyoung/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://psyjinx.com/jyoung</link>
	<description>web application developer</description>
	<lastBuildDate>Fri, 05 Mar 2010 18:55:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to open a window from terminal in cygwin on vista</title>
		<link>http://psyjinx.com/jyoung/2010/02/how-to-open-a-window-from-terminal-in-cygwin-on-vista/</link>
		<comments>http://psyjinx.com/jyoung/2010/02/how-to-open-a-window-from-terminal-in-cygwin-on-vista/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 11:42:11 +0000</pubDate>
		<dc:creator>James Young</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[dotfiles]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://psyjinx.com/jyoung/?p=237</guid>
		<description><![CDATA[<p>So I got a new Dell through work with Vista installed.  Naturally one of the first things I did was install cygwin so I can use mintty.  This gives me a decent terminal on widnows.  If you don&#8217;t know what those are, I encourage you to give them a shot.</p>
<p>Anyway, having used [...]]]></description>
			<content:encoded><![CDATA[<p>So I got a new Dell through work with Vista installed.  Naturally one of the first things I did was install cygwin so I can use mintty.  This gives me a decent terminal on widnows.  If you don&#8217;t know what those are, I encourage you to give them a shot.</p>
<p>Anyway, having used a mac forever, I found myself missing the &#8216;open&#8217; command that you can do from Terminal (on the mac) to pop open a window from the directory you are in.</p>
<p>With a quick search, I found that someone else already figured this out, so I am going to post my version of it here:</p>
<p>In your .bash_profile, add this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">open</span>=<span style="color: #ff0000;">&quot;cygstart <span style="color: #000099; font-weight: bold;">\$</span>1&quot;</span></pre></div></div>

<p>Then in mintty (or any cygwin terminal) you can cd to where ever you want, then just do &#8216;open [path]&#8216; and it will pop open a windows window for [path].</p>
<p>Examples:</p>
<ul>
<li>open current directory: <code>$ open .</code></li>
<li>open home directory : <code>$ open ~</code></li>
<li>open program files: <code>$ open ~/c/Program\ Files</code></li>
</ul>
<p>Note: that last one assumes you have made a symlink in your home to /cygdrive/c/</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~; <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>cygdrive<span style="color: #000000; font-weight: bold;">/</span>c</pre></div></div>

<p>Here is the original thread that I found this tip in:<br />
<a href="http://cygwin.com/ml/cygwin/2002-09/msg00632.html">http://cygwin.com/ml/cygwin/2002-09/msg00632.html</a></p>
<p>There are a few solutions posted, my favorite is:<br />
<a href="http://cygwin.com/ml/cygwin/2002-09/msg00635.html">http://cygwin.com/ml/cygwin/2002-09/msg00635.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://psyjinx.com/jyoung/2010/02/how-to-open-a-window-from-terminal-in-cygwin-on-vista/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My .bash_profile</title>
		<link>http://psyjinx.com/jyoung/2010/02/my-bash_profile/</link>
		<comments>http://psyjinx.com/jyoung/2010/02/my-bash_profile/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 13:11:10 +0000</pubDate>
		<dc:creator>James Young</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dotfiles]]></category>

		<guid isPermaLink="false">http://psyjinx.com/jyoung/?p=216</guid>
		<description><![CDATA[<p>.bash_profile, .profile, .bash_rc &#8230;</p>

if &#91; &#34;$PS1&#34; != &#34;&#34; &#93;; then
    PROMPT_COMMAND='echo -ne &#34;\033]0;${HOSTNAME}: ${PWD}\007&#34;'
    PS1=&#34;[\e[1;33m\u::${HOSTNAME} \t\[\e[1;35m\e[0m\]]$ &#34;
fi
&#160;
alias ls='ls -G'
alias ll='ls -l'
alias la='ll -a'
alias env='env &#124; sort'
alias ..='cd ..'
alias :e=vim
alias grepr='grep -rHn'
# finds and removes the ._ files that textmate creates
alias findmatefiles='find . -name ._*'
alias rmmatefiles='find . -name ._* -exec [...]]]></description>
			<content:encoded><![CDATA[<p>.bash_profile, .profile, .bash_rc &#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PS1</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">PROMPT_COMMAND</span>=<span style="color: #ff0000;">'echo -ne &quot;\033]0;${HOSTNAME}: ${PWD}\007&quot;'</span>
    <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;[\e[1;33m\u::<span style="color: #007800;">${HOSTNAME}</span> <span style="color: #000099; font-weight: bold;">\t</span>\[\e[1;35m\e[0m\]]$ &quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">ls</span></span>=<span style="color: #ff0000;">'ls -G'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll</span>=<span style="color: #ff0000;">'ls -l'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">la</span>=<span style="color: #ff0000;">'ll -a'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">env</span></span>=<span style="color: #ff0000;">'env | sort'</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;">e</span>=<span style="color: #c20cb9; font-weight: bold;">vim</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">grepr</span>=<span style="color: #ff0000;">'grep -rHn'</span>
<span style="color: #666666; font-style: italic;"># finds and removes the ._ files that textmate creates</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">findmatefiles</span>=<span style="color: #ff0000;">'find . -name ._*'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">rmmatefiles</span>=<span style="color: #ff0000;">'find . -name ._* -exec rm {} \;'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DEVROOT</span>=~<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTFILE</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.bash_history
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTSIZE</span>=<span style="color: #000000;">5000</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$HOME</span><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>MAMP<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>MAMP<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>y<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>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<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>X11R6<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>y<span style="color: #000000; font-weight: bold;">/</span>sbin:<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>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>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: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GREP_OPTIONS</span>=<span style="color: #ff0000;">'--color=auto'</span>
&nbsp;
setenv <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: #000000;">1</span>=<span style="color: #ff0000;">&quot;$2&quot;</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
unsetenv <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;">unset</span> <span style="color: #007800;">$*</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://psyjinx.com/jyoung/2010/02/my-bash_profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>command line reporting</title>
		<link>http://psyjinx.com/jyoung/2007/04/command-line-reporting/</link>
		<comments>http://psyjinx.com/jyoung/2007/04/command-line-reporting/#comments</comments>
		<pubDate>Sun, 29 Apr 2007 04:52:53 +0000</pubDate>
		<dc:creator>James Young</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://psyjinx.com/wp/?p=43</guid>
		<description><![CDATA[<p>Here are some things I have done in the past to pull data out of log files.  I find myself referring to this list from time to time to remember how I did things in the past.</p>

Real Queries That May Need To Be Repeated
&#160;
ATT YIH upgrades in the month of 200709
$ listysftclog 200709* &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some things I have done in the past to pull data out of log files.  I find myself referring to this list from time to time to remember how I did things in the past.</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">Real Queries That May Need To Be Repeated
&nbsp;
ATT YIH upgrades <span style="color: #804040;">in</span> the month of <span style="color: #000000; font-weight:bold;">200709</span>
<span style="color: #000000;">$</span> listysftclog <span style="color: #000000; font-weight:bold;">200709</span><span style="color: #000000;">*</span> <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/(yihupg[^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>r <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c
&nbsp;
Scratch Work
These searches are mostly captures <span style="color: #804040;">in</span> cronjobs and shell scripts<span style="color: #000000;">.</span> Using this page as a place to store some of them <span style="color: #804040;">while</span> working them out<span style="color: #000000;">.</span>
&nbsp;
Misc Searches
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/beacon.choice~([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> sed <span style="color: #C5A22D;">'s/&amp;/<span style="">\&amp;</span>/'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>nr
&nbsp;
Get page views <span style="color: #804040;">for</span> att<span style="color: #000000;">/</span>v4 choice page
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> grep choice<span style="color: #000000;">.</span>php <span style="color: #000000;">|</span> grep result<span style="color: #000000;">~</span><span style="color: #000000; font-weight:bold;">200</span> <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Get uniq visits to choice page
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> grep result<span style="color: #000000;">~</span><span style="color: #000000; font-weight:bold;">200</span> <span style="color: #000000;">|</span> cut <span style="color: #000000;">-</span>f10 <span style="color: #000000;">-</span>d\<span style="color: #000000;">|</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Get all user agents
This still needs some work, there is a <span style="color: #000000;">^</span>D <span style="color: #804040;">in</span> there that needs to be removed
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">/</span>home<span style="color: #000000;">/</span>y<span style="color: #000000;">/</span>logs<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/choiceua([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>nr
&nbsp;
Get Windows users
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">/</span>home<span style="color: #000000;">/</span>y<span style="color: #000000;">/</span>logs<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/choiceua([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> grep Windows <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Get Mac users
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">/</span>home<span style="color: #000000;">/</span>y<span style="color: #000000;">/</span>logs<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/choiceua([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> grep Mac <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Specific examples
   <span style="color: #000000;">*</span> Replace <span style="color: #000000;">&amp;</span> <span style="color: #804040;">in</span> <span style="color: #25BB4D;">search</span> results with <span style="color: #000000;">&amp;</span>
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/beacon.choice~([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> sed <span style="color: #C5A22D;">'s/&amp;/<span style="">\&amp;</span>/'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>nr
 <span style="color: #000000; font-weight:bold;">23</span> AT<span style="color: #000000;">&amp;</span>T Yahoo<span style="color: #000000;">!</span> Online Protection
 <span style="color: #000000; font-weight:bold;">13</span> Parental Controls
 <span style="color: #000000; font-weight:bold;">11</span> AT<span style="color: #000000;">&amp;</span>T Yahoo<span style="color: #000000;">!</span> Messenger
 <span style="color: #000000; font-weight:bold;">11</span> AT<span style="color: #000000;">&amp;</span>T Yahoo<span style="color: #000000;">!</span> Browser
 <span style="color: #000000; font-weight:bold;">11</span> AT<span style="color: #000000;">&amp;</span>T Toolbar
  <span style="color: #000000; font-weight:bold;">6</span> Connection Manager
  <span style="color: #000000; font-weight:bold;">2</span> AT<span style="color: #000000;">&amp;</span>T Pop<span style="color: #000000;">-</span>Up Blocker
  <span style="color: #000000; font-weight:bold;">1</span> AT<span style="color: #000000;">&amp;</span>T Security Suite SM</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://psyjinx.com/jyoung/2007/04/command-line-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
