<?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>blog.lundscape.com &#187; Shell</title>
	<atom:link href="http://blog.lundscape.com/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lundscape.com</link>
	<description>The Linux Journey</description>
	<lastBuildDate>Thu, 15 Apr 2010 20:06:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Run a Shell Command in a Makefile</title>
		<link>http://blog.lundscape.com/2009/11/run-a-shell-command-in-a-makefile/</link>
		<comments>http://blog.lundscape.com/2009/11/run-a-shell-command-in-a-makefile/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 17:26:41 +0000</pubDate>
		<dc:creator>Zachary Lund</dc:creator>
				<category><![CDATA[Make]]></category>
		<category><![CDATA[File Conversion]]></category>
		<category><![CDATA[Makefile]]></category>
		<category><![CDATA[PostScript]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://blog.lundscape.com/?p=261</guid>
		<description><![CDATA[I had a directory of BMP image files that I wanted to convert to EPS (Encapsulated PostScript). Since I was planning on adding files to the directory, I did not want to hard code the names of the files into the makefile that would do the conversion. Therefore, the trick was to run a shell [...]]]></description>
			<content:encoded><![CDATA[<p>I had a directory of BMP image files that I wanted to convert to EPS (Encapsulated PostScript). Since I was planning on adding files to the directory, I did not want to hard code the names of the files into the makefile that would do the conversion. Therefore, the trick was to run a shell command inside of the makefile. The first line lists all of the BMP files and assigns it to &#8220;BMP_FILES&#8221;. The next line replaces the &#8220;bmp&#8221; extension with &#8220;eps&#8221;. The complete makefile is below.</p>
<pre>BMP_FILES = $(shell ls *.bmp)
EPS_FILES = ${BMP_FILES:%.bmp=%.eps}

all: ${EPS_FILES}

%.eps : %.bmp
	convert $*.bmp $*.eps</pre>
<p>All that is left is to type &#8220;make&#8221; in the directory, and all of the BMP files will be converted to EPS.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lundscape.com/2009/11/run-a-shell-command-in-a-makefile/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bad Bash Sourcing</title>
		<link>http://blog.lundscape.com/2009/03/bad-bash-sourcing/</link>
		<comments>http://blog.lundscape.com/2009/03/bad-bash-sourcing/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:32:18 +0000</pubDate>
		<dc:creator>Zachary Lund</dc:creator>
				<category><![CDATA[Secure Shell]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.lundscape.com/?p=53</guid>
		<description><![CDATA[A while back I switched such that my .bash_profile sources my .bashrc instead of the reverse. Based on a few sources, this seems to be the preferred approach. Today I decided to push those files to a few servers that haven&#8217;t been updated lately. I transferred my .bash_profile and then my .bashrc:
zac@dakara:~$ scp ~/.environment/bash/bash_profile lansky:~/.bash_profile
bash_profile [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I switched such that my .bash_profile sources my .bashrc instead of the reverse. Based on a few sources, this seems to be the preferred approach. Today I decided to push those files to a few servers that haven&#8217;t been updated lately. I transferred my .bash_profile and then my .bashrc:</p>
<pre>zac@dakara:~$ scp ~/.environment/bash/bash_profile lansky:~/.bash_profile
bash_profile                                  100%  120     0.1KB/s   00:00
zac@dakara:~$ scp ~/.environment/bash/bashrc lansky:~/.bashrc
lost connection</pre>
<p>What happened? My .bash_profile sources my .bashrc, but since I hadn&#8217;t yet replaced the .bashrc, it still sources my .bash_profile. That means infinite loop and that I am an idiot. SSH, rsync, and scp are all broken. There is no way to remove or replace either of those files without another account. I guess it&#8217;s time to open a support ticket at DreamHost.</p>
<p>The moral of the story is to always be careful how you source those files. I usually try to keep an SSH session open on the remote machine when I modify those files in case I break login, but this time I didn&#8217;t. A few searches didn&#8217;t reveal any solutions. I&#8217;d love to know if someone has a way of resolving this without access to another account on the remote machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lundscape.com/2009/03/bad-bash-sourcing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Bash Completion</title>
		<link>http://blog.lundscape.com/2009/02/advanced-bash-completion/</link>
		<comments>http://blog.lundscape.com/2009/02/advanced-bash-completion/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 22:42:50 +0000</pubDate>
		<dc:creator>Zachary Lund</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Bash Completion]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.lundscape.com/?p=50</guid>
		<description><![CDATA[Ubuntu has a lot of advanced bash completion features that simplify using the shell. For example, when using the ssh command, I can tab complete server names based on my host file and my ssh config file. It turns out that most of this is accomplished with one bash_completion script. This page has a lot [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu has a lot of advanced bash completion features that simplify using the shell. For example, when using the ssh command, I can tab complete server names based on my host file and my ssh config file. It turns out that most of this is accomplished with one bash_completion script. This <a href="http://www.caliban.org/bash/index.shtml">page</a> has a lot of useful information about the Bash shell and also the very useful script. I&#8217;ve found that when I use Fedora in the Xinu lab, I am left typing a lot of this stuff myself. Since I use the same bashrc file on both Dakara and my lab machine (Kastria), I didn&#8217;t want to always resource the file so I added this to my bashrc:</p>
<pre># Source global definitions
[ -f /etc/bashrc ]      &#038;&#038; source /etc/bashrc
[ -f /etc/bash.bashrc ] &#038;&#038; source /etc/bash.bashrc
# enable programmable completion features
if [ -z "$BASH_COMPLETION" \
    -a -r ~/.configuration/bash/bash_completion.caliban ]; then
    BASH_COMPLETION=~/.configuration/bash/bash_completion.caliban
    source $BASH_COMPLETION
fi</pre>
<p>First, I source the global definitions, Ubuntu uses /etc/bashrc, and Fedora uses /etc/bash.bashrc. After that, if the bash_completion script was already sourced, $BASH_COMPLETION will be set. I check to see if it is zero length (-z) and then source my own copy of it if it is. Now I have advanced bash completion on both Ubuntu and Fedora.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lundscape.com/2009/02/advanced-bash-completion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Flash on Mac OS X from the command line</title>
		<link>http://blog.lundscape.com/2009/02/install-flash-on-os-x-from-the-command-line/</link>
		<comments>http://blog.lundscape.com/2009/02/install-flash-on-os-x-from-the-command-line/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 04:59:20 +0000</pubDate>
		<dc:creator>Zachary Lund</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[hdiutil]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.lundscape.com/?p=25</guid>
		<description><![CDATA[My mother needed the latest version of Flash to view a web page. I decided this was a good opportunity to install the package from the command line over secure shell. She has a PowerMac G4 running Mac OS X 10.4. It turns out that the update didn't work, but I relearned a bit about some useful command line tools for Mac OS X.]]></description>
			<content:encoded><![CDATA[<p>My mother needed the latest version of Flash to view a web page. I decided this was a good opportunity to install the package from the command line over secure shell. She has a PowerMac G4 running Mac OS X 10.4. It turns out that the update didn&#8217;t work, but I relearned a bit about some useful command line tools for Mac OS X. I always start in the temp directory. Then I downloaded the installer and unzipped it. That&#8217;s all pretty straightforward.</p>
<pre>cd /tmp/
curl -O http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_osx_ub.dmg.zip
unzip install_flash_player_osx_ub.dmg.zip</pre>
<p>Next, I used &#8220;hdiutil&#8221; to mount the disk image and then changed to that directory.</p>
<pre>hdiutil attach Install\ Flash\ Player\ 10\ UB.dmg
cd /Volumes/Install\ Flash\ Player\ 10\ UB/</pre>
<p>Then I used &#8220;installer&#8221; to install the package specifying the package with &#8220;-pkg Adobe\ Flash\ Player.pkg&#8221; and the target volume with &#8220;-target /&#8221;.</p>
<pre>installer -verbose -pkg Adobe\ Flash\ Player.pkg -target /</pre>
<p>It will run through the installation and output some information. After that, I changed back to the temp directory. I initially tried using &#8220;umount&#8221; to unmount the disk image, but that is a bad idea because it doesn&#8217;t fully unmount the image. The better approach is to use the &#8220;hdiutil&#8221; again. I find the volume to unmount by using the &#8220;df&#8221; command. Once it is unmounted, I deleted the zip file and the disk image.</p>
<pre>cd /tmp/
hdiutil detach $(df | grep Flash | awk '{print $1}')
rm install_flash_player_osx_ub.dmg.zip
rm Install\ Flash\ Player\ 10\ UB.dmg</pre>
<p>Most applications for Mac OS X come in disk images, and many of those have package installers. This is a quick way to install software on a remote Macintosh or a way to automate installations with scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lundscape.com/2009/02/install-flash-on-os-x-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your own personal man directory</title>
		<link>http://blog.lundscape.com/2009/02/your-own-personal-man-directory/</link>
		<comments>http://blog.lundscape.com/2009/02/your-own-personal-man-directory/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 15:08:04 +0000</pubDate>
		<dc:creator>Zachary Lund</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[man]]></category>
		<category><![CDATA[manpath]]></category>

		<guid isPermaLink="false">http://blog.lundscape.com/?p=16</guid>
		<description><![CDATA[Recently, I wanted to install a program in my home bin directory, and it had a man page to go with it. I started looking for a way to create my own personal man directory.]]></description>
			<content:encoded><![CDATA[<p>Recently, I wanted to install a program in my home bin directory, and it had a man page to go with it. I started looking for a way to create my own personal man directory. According to the manual page for man, &#8220;man uses a sophisticated method of finding manual page files.&#8221; Indeed it does. It turns out that all I had to do was create a man directory inside of my home directory and man would know it was there:</p>
<pre>zac@dakara:~$ manpath
/usr/local/man:/usr/local/share/man:/usr/share/man
zac@dakara:~$ mkdir man
zac@dakara:~$ manpath
/home/zac/man:/usr/local/man:/usr/local/share/man:/usr/share/man</pre>
<p>Then to install the man page, I simply had to create the appropriate directory structure and copy the man page in:</p>
<pre>zac@dakara:~$ mkdir -p man/en/man1/</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.lundscape.com/2009/02/your-own-personal-man-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
