summaryrefslogtreecommitdiff
path: root/web/lukeshu.ath.cx/1/wordpress/2010/09/hello-world/index.html
blob: d9017d257c68639829916e1301817d062016aaf2 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" >
<head>
	<title>Lesson 1: Bourne Shell Scripting | ltsBlog</title>
	<link href="/1/lts.css"                             rel="stylesheet" type="text/css" media="screen,projection" />
	<link href="http://lukeshu.ath.cx/1/wordpress/wp-content/themes/lts/style.css" rel="stylesheet" type="text/css" media="all" />
	<link href="http://lukeshu.ath.cx/1/wordpress/wp-content/themes/lts/widgets.css" rel="stylesheet" type="text/css" media="screen,projection" />
	<link rel="pingback" href="http://lukeshu.ath.cx/1/wordpress/xmlrpc.php" />
<link rel="alternate" type="application/rss+xml" title="ltsBlog &raquo; Feed" href="http://lukeshu.ath.cx/1/wordpress/feed/" />
<link rel="alternate" type="application/rss+xml" title="ltsBlog &raquo; Comments Feed" href="http://lukeshu.ath.cx/1/wordpress/comments/feed/" />
<link rel="alternate" type="application/rss+xml" title="ltsBlog &raquo; Lesson 1: Bourne Shell Scripting Comments Feed" href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/feed/" />
<script type='text/javascript' src='http://lukeshu.ath.cx/1/wordpress/wp-includes/js/l10n.js?ver=20101110'></script>
<script type='text/javascript' src='http://lukeshu.ath.cx/1/wordpress/wp-includes/js/comment-reply.js?ver=20090102'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://lukeshu.ath.cx/1/wordpress/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://lukeshu.ath.cx/1/wordpress/wp-includes/wlwmanifest.xml" /> 
<link rel='index' title='ltsBlog' href='http://lukeshu.ath.cx/1/wordpress/' />
<link rel='start' title='Lesson 1: Bourne Shell Scripting' href='http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/' />
<link rel='next' title='What I Know for Sure' href='http://lukeshu.ath.cx/1/wordpress/2010/10/school-essay-what-i-know-for-sure/' />
<meta name="generator" content="WordPress 3.2.1" />
<link rel='canonical' href='http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/' />
<link rel='shortlink' href='http://lukeshu.ath.cx/1/wordpress/?p=1' />
 
</head>

<body>
	<div class="nocss">
		<ul>
			<li><a href="#navigation">Skip to Navigation</a></li>
			<li><a href="#content">Skip to Content</a></li>
			<li><a href="#footer">Skip to Disclaimer</a></li>
		</ul>
	</div>
 
 
	<h1><a href="http://lukeshu.ath.cx/1/wordpress/" title="ltsBlog" rel="home">ltsBlog</a></h1> 
 
	<div class="nav"><a class="nocss" id="navigation"></a>
		<ul>
			<li><a href="/1/">Home</a></li>
			<li><a href="/1/FRC/">Robots</a></li>
			<li><a href="/1/img/">Pictures</a></li>
			<li><a href="/1/wordpress/">Weblog</a></li>
			<li><a href="/1/comicjk/viewer.php">Comic JK</a></li>
		</ul>
	</div>
 
 

	<div class="sidebar widget-area">
		<ul class="xoxo">
<li id="search-2" class="widget-container widget_search">	<form method="get" id="searchform" action="/1/wordpress/" >
		<div>
			<label class="screen-reader-text" for="s">Search ltsBlog:</label>
			<input type="text" value="" name="s" id="s" />
			<input type="submit" id="searchsubmit" value="Search" />
		</div>
	</form>
</li>              <li id="statusnetwidget-4" class="widget-container widget_statusnetwidget">                  <span class="widget-title">Me on identi.ca</span>                  <ul class="statusnet"><li class="statusnet-item">Someone egged a bunch of cars in our neighborhood. <span class="statusnet-timestamp"><abbr title="2011/12/03 05:58:48"><a href="http://identi.ca/notice/86136803">2011/12/03</a></abbr></span></li><li class="statusnet-item"><a href="http://identi.ca/group/git">!git</a>. is. such. win. <span class="statusnet-timestamp"><abbr title="2011/11/27 20:32:11"><a href="http://identi.ca/notice/85848970">2011/11/27</a></abbr></span></li><li class="statusnet-item">My favorite sites could get shut down by 1st censorship system for the internet. Must stop it: 11/16  <a href="http://ur1.ca/5qyod">http://ur1.ca/5qyod</a> <span class="statusnet-timestamp"><abbr title="2011/11/16 12:46:11"><a href="http://identi.ca/notice/85359960">2011/11/16</a></abbr></span></li><li class="statusnet-item">One of these days I'll hack <a href="http://identi.ca/group/emacs">!emacs</a> daemon to expose the server via 9p. <span class="statusnet-timestamp"><abbr title="2011/11/03 21:51:32"><a href="http://identi.ca/notice/84892668">2011/11/03</a></abbr></span></li></ul>              </li>        		<li id="recent-posts-2" class="widget-container widget_recent_entries">		<span class="widget-title">Recent Posts</span>		<ul>
				<li><a href="http://lukeshu.ath.cx/1/wordpress/2011/08/fixing-wrong-type-argument-characterp-return-in-emacs/" title="Fixing &#8220;Wrong type argument: characterp, return&#8221; in !Emacs">Fixing &#8220;Wrong type argument: characterp, return&#8221; in !Emacs</a></li>
				<li><a href="http://lukeshu.ath.cx/1/wordpress/2011/08/emacs-autopair-problems-when-using-term-mode/" title="[Emacs] autopair problems when using term-mode">[Emacs] autopair problems when using term-mode</a></li>
				<li><a href="http://lukeshu.ath.cx/1/wordpress/2011/05/why-sed-i-exists/" title="Why `sed -i&#8217; exists">Why `sed -i&#8217; exists</a></li>
				<li><a href="http://lukeshu.ath.cx/1/wordpress/2011/02/questions-about-copyright-of-the-deceased/" title="Questions about copyright of the deceased">Questions about copyright of the deceased</a></li>
				<li><a href="http://lukeshu.ath.cx/1/wordpress/2011/01/pointers-in-java/" title="Pointers in Java">Pointers in Java</a></li>
				</ul>
		</li><li id="recent-comments-2" class="widget-container widget_recent_comments"><span class="widget-title">Recent Comments</span><ul id="recentcomments"><li class="recentcomments"><a href='http://lukeshu.ath.cx/1/wordpress/2011/08/fixing-wrong-type-argument-characterp-return-in-emacs/' rel='external nofollow' class='url'>Fixing &#8220;Wrong type argument: characterp, return&#8221; in !Emacs | ltsBlog</a> on <a href="http://lukeshu.ath.cx/1/wordpress/2011/08/emacs-autopair-problems-when-using-term-mode/#comment-94">[Emacs] autopair problems when using term-mode</a></li><li class="recentcomments"><a href='http://lukeshu.ath.cx' rel='external nofollow' class='url'>lts</a> on <a href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/#comment-58">Lesson 1: Bourne Shell Scripting</a></li><li class="recentcomments"><a href='http://lukeshu.ath.cx' rel='external nofollow' class='url'>lts</a> on <a href="http://lukeshu.ath.cx/1/wordpress/2011/01/pointers-in-java/#comment-56">Pointers in Java</a></li><li class="recentcomments">Ari Consul on <a href="http://lukeshu.ath.cx/1/wordpress/2011/01/pointers-in-java/#comment-54">Pointers in Java</a></li><li class="recentcomments">Jade Parsons on <a href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/#comment-52">Lesson 1: Bourne Shell Scripting</a></li></ul></li><li id="archives-2" class="widget-container widget_archive"><span class="widget-title">Archives</span>		<ul>
			<li><a href='http://lukeshu.ath.cx/1/wordpress/2011/08/' title='August 2011'>August 2011</a></li>
	<li><a href='http://lukeshu.ath.cx/1/wordpress/2011/05/' title='May 2011'>May 2011</a></li>
	<li><a href='http://lukeshu.ath.cx/1/wordpress/2011/02/' title='February 2011'>February 2011</a></li>
	<li><a href='http://lukeshu.ath.cx/1/wordpress/2011/01/' title='January 2011'>January 2011</a></li>
	<li><a href='http://lukeshu.ath.cx/1/wordpress/2010/11/' title='November 2010'>November 2010</a></li>
	<li><a href='http://lukeshu.ath.cx/1/wordpress/2010/10/' title='October 2010'>October 2010</a></li>
	<li><a href='http://lukeshu.ath.cx/1/wordpress/2010/09/' title='September 2010'>September 2010</a></li>
		</ul>
</li><li id="categories-2" class="widget-container widget_categories"><span class="widget-title">Categories</span>		<ul>
	<li class="cat-item cat-item-8"><a href="http://lukeshu.ath.cx/1/wordpress/category/computers/" title="View all posts filed under Computers">Computers</a>
</li>
	<li class="cat-item cat-item-7"><a href="http://lukeshu.ath.cx/1/wordpress/category/school-2/essays/" title="View all posts filed under Essays">Essays</a>
</li>
	<li class="cat-item cat-item-12"><a href="http://lukeshu.ath.cx/1/wordpress/category/morning-pages/" title="View all posts filed under morning-pages">morning-pages</a>
</li>
	<li class="cat-item cat-item-9"><a href="http://lukeshu.ath.cx/1/wordpress/category/computers/programming-lessons/" title="View all posts filed under Programming Lessons">Programming Lessons</a>
</li>
	<li class="cat-item cat-item-6"><a href="http://lukeshu.ath.cx/1/wordpress/category/school-2/" title="View all posts filed under School">School</a>
</li>
	<li class="cat-item cat-item-1"><a href="http://lukeshu.ath.cx/1/wordpress/category/uncategorized/" title="View all posts filed under Uncategorized">Uncategorized</a>
</li>
		</ul>
</li><li id="meta-2" class="widget-container widget_meta"><span class="widget-title">Meta</span>			<ul>
			<li><a href="http://lukeshu.ath.cx/1/wordpress/wp-login.php?action=register">Register</a></li>			<li><a href="http://lukeshu.ath.cx/1/wordpress/wp-login.php">Log in</a></li>
			<li><a href="http://lukeshu.ath.cx/1/wordpress/feed/" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>
			<li><a href="http://lukeshu.ath.cx/1/wordpress/comments/feed/" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>
			<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li>
						</ul>
</li><li id="ltshomewidget-3" class="widget-container widget_ltshomewidget">	<ul class="lts_sidebar">
		<li><a href="http://www.defectivebydesign.org/intel"><img src="http://static.fsf.org/nosvn/dbd/stop-intel-med.png" alt="stop Intel" /></a></li>
		<li>
<!-- Beginning of Project Wonderful ad code: -->
<!-- Ad box ID: 51613 -->
<script type="text/javascript">
<!--
var pw_d=document;
pw_d.projectwonderful_adbox_id = "51613";
pw_d.projectwonderful_adbox_type = "4";
pw_d.projectwonderful_foreground_color = "";
pw_d.projectwonderful_background_color = "";
//-->
</script>
<script type="text/javascript" src="http://www.projectwonderful.com/ad_display.js"></script>
<!-- End of Project Wonderful ad code. -->
</li>
	</ul>
</li> 
		</ul>
	</div><!-- .sidebar -->

 
 

	<div class="main"><a class="nocss" id="content"></a>
	 
		<div id="nav-above" class="navigation">
			<div class="nav-previous"></div>
			<div class="nav-next"><a href="http://lukeshu.ath.cx/1/wordpress/2010/10/school-essay-what-i-know-for-sure/" rel="next">What I Know for Sure <span class="meta-nav">&rarr;</span></a></div>
		</div><!-- #nav-above -->
		
		<div id="post-1" class="post-1 post type-post status-publish format-standard hentry category-computers category-programming-lessons tag-progtut">
			<h2 class="entry-title">Lesson 1: Bourne Shell Scripting</h2>
			<div class="entry-meta">
				<span class="meta-prep meta-prep-author">Posted on</span> <a href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/" title="23:49" rel="bookmark"><span class="entry-date">2010/09/25</span></a> <span class="meta-sep">by</span> <span class="author vcard"><a class="url fn n" href="http://lukeshu.ath.cx/1/wordpress/author/lts/" title="View all posts by lts">lts</a></span> 
			</div><!-- .entry-meta -->
			<div class="entry-content">
<h4>Introduction</h4>
<p>This is the first installment in a series of articles introducing one to programming and hacking in general.</p>
<p>One pitfall that comes with teaching users unfamiliar with a shell to program is that they often struggle with concepts such as arguments and Standard In/Out.  So, at Nathan&#8217;s suggestion have decided to begin with shell scripting.</p>
<p>The &#8220;shell&#8221; is the program that you use to interact with the operating system and launch programs.  Many users are familiar with graphical shells, such as explorer.exe in MS Windows NT, X in *NIX, or Quartz on Mac OS X.  However, &#8220;shell&#8221; is usually used to mean a command-line shell.  I will try to teach about shells in the Bourne family, but will focus on GNU <acronym title="Bourne Again SHell">BASH</acronym>.  Bourne shells are nice in the fact that they are both a well-designed language, and a complete user interface.</p>
<h4>Acquiring BASH</h4>
<p>Almost any modern UNIX-like system will include BASH.  If you already have a Mac OS X, BSD, or GNU/Linux machine then you probably already have BASH.  If you use MS Windows, I would recommend erasing it and installing a <a href="http://fsf.org">Free</a> UNIX-like system.  However, since this may not be an option, you can install a program called <a href="http://www.cygwin.com/">Cygwin</a> that makes Windows like a *NIX system.</p>
<p>If you use Cygwin, be sure to have it install BASH, and `bc&#8217;, `sed&#8217;, and `grep&#8217;, and nano (at least) (I don&#8217;t think it installs bc or nano by default).</p>
<ul>
<li>To access BASH on Mac OS X, launch the &#8220;Terminal&#8221; app.</li>
<li>To access BASH on GNU/Linux, launch `xterm&#8217; or another terminal emulator; or hit <kbd>&lt;ctrl&gt;+&lt;alt&gt;+F1</kbd> for a full-screen terminal.</li>
<li>To access BASH on Cygwin there should be a program in the &#8220;All Programs&#8221; menu from the Start menu.</li>
</ul>
<h4>Your first Shell script</h4>
<p>Open a BASH session.  You should see a &#8220;<samp>$ </samp>&#8221; prompt, possibly with other text such as username and the current directory (folder). Because of this when you see a command like &#8220;<samp>$ cp foo foo.bak</samp>&#8221;, the &#8220;<code>$ </code>&#8221; only indicates that it is a shell command; you don&#8217;t actually type the dollar sign.</p>
<p>Use the <code>$ nano script1.sh</code> command to create and edit the file &#8220;script1.sh&#8221; with the nano text editor.</p>
<p class="aside">In my examples I use nano, but feel free to use another text editor.  I chose GNU nano because it is new-user friendly, comes pre-installed on Mac OS X, most modern *NIXen, and is easily installed with Cygwin.  While there are many better new-user friendly text editors, such as Notepad++ and gedit, they are not the same across all systems.  Additionally, there are many more sophisticated editors such as Emacs or VI that are awesome, but take some time to learn. I personally use GNU Emacs.</p>
<p>For the first line of the file, type:</p>
<pre>#!/bin/bash</pre>
<p>This tells the operating system how to run text files as programs.  Most programs are binary files that the computer can run directly, and humans can&#8217;t really read.  However, text scripts that reverse this; we can read them, but the computer needs help.  In this case, it checks to see if the file begins with a shebang (hash[#]-bang[!]), and if it does, uses the binary program file on the line after it to read the program.  Since we are writing a BASH script, we list &#8220;<code>/bin/bash</code>&#8221;, which is where BASH is usually installed.</p>
<p>Now, if you are even slightly familiar with the command line, you know that a command-line shell primarily takes a simple list of commands, in order.  Writing a shell script like this is exactly like typing it directly at the command-line.  Well, actually, there are 2 differences:</p>
<ol>
<li>The shell won&#8217;t be interactive, it won&#8217;t print the prompt before each command.</li>
<li>The shell will exit when it&#8217;s done, instead of waiting for another command.</li>
</ol>
<p>Now, the first program anyone ever learns to write is &#8220;hello world&#8221;, so:</p>
<pre>#!/bin/bash
echo 'Hello, world!'
</pre>
<p>Once you have entered this into your editor, save and return to your interactive shell.  In nano, do this by entering <kbd>&lt;ctrl&gt;+o</kbd> to save, and <kbd>&lt;ctrl&gt;+x</kbd> to exit back to the shell.  Now, in order to run the script as a program, we must let the computer know that it is a program, tell the computer that it is &#8220;executable&#8221;.  Do this by running the command &#8220;<code>$ chmod +x script1.sh</code>&#8221; (<strong>ch</strong>ange <strong>mod</strong>e +e<strong>x</strong>ecutable on the file &#8220;<strong>script1.sh</strong>&#8221;).</p>
<p>Now, actually running your program.  I could simply tell you run &#8220;<code>$ ./script1.sh</code>&#8221;, but I&#8217;ll instead take the time to explain why this is how you run the program, and why you need &#8220;<code>./</code>&#8221; for it, and you don&#8217;t for most programs.  There are two ways to tell BASH what program to run:</p>
<ol>
<li>Give just the command/file name, and check the PATH and shell built-ins for the command.</li>
<li>Give the <em>path</em> to the specific file.</li>
</ol>
<p><strong>The first way</strong> is by far the most common, let me explain how it works.  Take for example the &#8220;<code>echo</code>&#8221; command we used.  Since it does not contain a &#8220;<kbd>/</kbd>&#8221; it must be a filename, rather than a path.  BASH can be first checks it&#8217;s list of built-in commands, and uses built-in echo.  However, you can configure BASH to disable most built-in commands, in which case it would not find the built-in echo, and begin to look in the PATH.  PATH is a special environmental variable that tells shells where to look for programs.  To see what your PATH is, run &#8220;<code>$ echo $PATH</code>&#8221;.  For example, my current PATH is:</p>
<pre>/home/luke/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</pre>
<p>Now, path is a list of directory/folder locations, separated by colons.  The shell will look in the first folder for a file with the name of the command.  So, on my system, BASH will look for the file &#8220;<kbd>/home/luke/bin/echo</kbd>&#8221;, which doesn&#8217;t exist, so it will go on and look in the next folder, until it eventually finds &#8220;<kbd>/bin/echo</kbd>&#8221;, when it will run that file.  If the shell can&#8217;t find a command with that name, it will display an error message. <strong>The second way</strong>, we give the path directly to the command we want to run, the folder it&#8217;s in, and the file in it.  So, if I didn&#8217;t want to re-configure BASH, but wanted to run the non-built-in version of echo, I could type &#8220;<code>$ /bin/echo 'Hello, world!'</code>&#8221;.  BASH knows that this is a complete path because it does contain a &#8220;<kbd>/</kbd>&#8221;.  Now, you can either give the an absolute path, or a relative path.  An absolute path gives is like saying &#8220;at this address&#8221;, where a relative path is like saying &#8220;1 mile east from here&#8221;.  Now, on a UNIX-like operating system, the file-system begins with &#8220;<kbd>/</kbd>&#8221; as the root folder, all other folders go inside of it, so if the path begins with a &#8220;<kbd>/</kbd>&#8221;, then it is an absolute path.  If the path does not begin with a slash, then the first item listed is directly inside of the current directory.  So, since our program is directly in the same directory as we are, so it would just be &#8220;<code>script1.sh</code>&#8221;, right?  Well, then bash doesn&#8217;t know that it&#8217;s a path, rather than a command, so how do we add a slash, but not have to list exactly where we currently are?  The simple answer is that on UNIX-like systems all directories always have at least 2 sub-directories, &#8220;<kbd>.</kbd>&#8221; and &#8220;<kbd>..</kbd>&#8221;, both with special meanings.  &#8220;<kbd>.</kbd>&#8221; is the same folder that it&#8217;s in, so &#8220;<samp>/home/luke/././././</samp>&#8221; is the same as just &#8220;<samp>/home/luke/</samp>&#8221;.  &#8220;<kbd>..</kbd>&#8221; is the parent directory, the directory that this one is inside of; so &#8220;<samp>/home/luke/../</samp>&#8221; is the same as &#8220;<samp>/home/</samp>&#8221;.  So, when we want to say that something is directly in the current directory, and we need a slash, we can use &#8220;<kbd>./script1.sh</kbd>&#8221;, which is the same location as &#8220;<kbd>script1.sh</kbd>&#8221;, but BASH knows that it&#8217;s a path.</p>
<h4>Variables</h4>
<p>TODO</p>
<h4>Standard Out</h4>
<p>TODO</p>
<h4>Standard In</h4>
<p>TODO</p>
<h4>Flow control</h4>
<p>TODO</p>
<h4>Afterward/Other resources</h4>
<p>As will be norm, if you wish to become proficient in a language, you must do more than just read my Lessons, you must find other resources, but more importantly, <em>do something</em>, find hands-on experience.  Just this weekend, I wrote a system monitor (a program to display things like processor use, memory consumption, battery level, etc.) in BASH, and even though I already considered myself proficient with both my operating system, and BASH, in doing so learned several things about both (namely, BASH <code>trap</code>s).</p>
<p>Anyway, about other resources: I often have trouble recommending resources to people, since I feel that there are so few good resources available, and that 90% of the resources available are crap.  However, I feel confident recommending the book <span class="title">Advanced Bash-Scripting Guide</span>, available online at <a href="http://tldp.org/LDP/abs/">The <acronym title="Linux Documentation Project">LDP</acronym></a> in many formats (to view in your web browser, go for the HTML version).  One page that is especially useful, even to experienced coders is its <a href="http://tldp.org/LDP/abs/html/refcards.html">Reference Cards</a> page. While the book is a great resource, there are several minor issues with it that I need to address before I feel comfortable recommending it:</p>
<ul>
<li>It frequently says &#8220;Linux&#8221; when it means &#8220;GNU/Linux&#8221;, which is especially unfortunate because there are times when it really does mean just &#8220;Linux&#8221;.</li>
<li>It frequently uses the word &#8220;hack&#8221; when it means &#8220;crack&#8221;.</li>
<li>Don&#8217;t believe it 100% when it says something about defaults, or that some operating system does something.  For example, it claims several times that all GNU/Linux (well, it says just &#8220;Linux&#8221;) systems that <acronym title="Bourne Again SHell">BASH</acronym> is the default shell.  This is generally true, many do, but several do not, namely Ubuntu, for which the default is <abbr title="Debian ASH (Almquist SHell)">DASH</abbr>.</li>
</ul>
<p>Less specifically, <a href="http://oreilly.com/">O&#8217;Reilly Media</a> is well-known among hackers for providing quality resources, often written by hackers themselves.  Especially the books with an animal on the front, those are good stuff.</p>
 
			</div><!-- .entry-content -->
			<div class="entry-links">
				 
			</div>
			 
			<div class="entry-utility">
				This entry was posted in <a href="http://lukeshu.ath.cx/1/wordpress/category/computers/" title="View all posts in Computers" rel="category tag">Computers</a>, <a href="http://lukeshu.ath.cx/1/wordpress/category/computers/programming-lessons/" title="View all posts in Programming Lessons" rel="category tag">Programming Lessons</a> and tagged <a href="http://lukeshu.ath.cx/1/wordpress/tag/progtut/" rel="tag">progtut</a>. Bookmark the <a href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/" title="Permalink to Lesson 1: Bourne Shell Scripting" rel="bookmark">permalink</a>. 
				 
			</div><!-- .entry-utility -->
		</div><!-- #post-## -->
		
		<div id="nav-below" class="navigation">
			<div class="nav-previous"></div>
			<div class="nav-next"><a href="http://lukeshu.ath.cx/1/wordpress/2010/10/school-essay-what-i-know-for-sure/" rel="next">What I Know for Sure <span class="meta-nav">&rarr;</span></a></div>
		</div><!-- #nav-below -->
		
		 

		<div id="comments">
 
			<h3 id="comments-title">2 Responses to <em>Lesson 1: Bourne Shell Scripting</em></h3>
 
			<ol class="commentlist">
				 
				<li class="comment even thread-even depth-1" id="li-comment-52">
					<div id="comment-52">
						<div class="comment-author vcard">
							<img alt='' src='http://1.gravatar.com/avatar/bbb2091bd464a2fe712ed91a0e146f71?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G' class='avatar avatar-40 photo' height='40' width='40' /> 
							<cite class="fn">Jade Parsons</cite> <span class="says">says:</span> 
						</div><!-- .comment-author .vcard -->
					 
						<div class="comment-meta commentmetadata"><a href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/#comment-52">
							2011/06/17 at 15:32</a> 
						</div><!-- .comment-meta .commentmetadata -->
						<div class="comment-body">
<p>Hi Luke. I remembered you saying you have a website, so being the curious person I am, I decided to check it out. Now I could use some help. I opened BASH session and am a tad bit confused. Your entry says,&#8221;Use the $ nano script1.sh command to create and edit the file “script1.sh” with the nano text editor.&#8221; This is where I got lost. I tried typing &#8220;script1.sh&#8221; in, but that was not it of course. So where do I: 1.use the $ nano script1.sh 2.create the file? Maybe I am a little mixed up. I could use some clarification please.</p>
						</div>
						<div class="reply">
							<a class='comment-reply-link' href='/1/wordpress/2010/09/hello-world/?replytocom=52#respond' onclick='return addComment.moveForm("comment-52", "52", "respond", "1")'>Reply</a> 
						</div><!-- .reply -->
					</div><!-- #comment-##  -->
				
<ul class='children'>
 
				<li class="comment byuser comment-author-lts bypostauthor odd alt depth-2" id="li-comment-58">
					<div id="comment-58">
						<div class="comment-author vcard">
							<img alt='' src='http://0.gravatar.com/avatar/002a91d6bdfd6cfecde043c0a7f39123?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G' class='avatar avatar-40 photo' height='40' width='40' /> 
							<cite class="fn"><a href='http://lukeshu.ath.cx' rel='external nofollow' class='url'>lts</a></cite> <span class="says">says:</span> 
						</div><!-- .comment-author .vcard -->
					 
						<div class="comment-meta commentmetadata"><a href="http://lukeshu.ath.cx/1/wordpress/2010/09/hello-world/#comment-58">
							2011/06/29 at 05:29</a> 
						</div><!-- .comment-meta .commentmetadata -->
						<div class="comment-body">
<p>When you open the BASH prompt, type nano script1.sh. This will open the file in Nano. If the file does not exist, it will be created when you save.</p>
<p>In Nano you save with Ctrl-O.</p>
<p>At the bottom where you see &#8220;^G Get Help&#8221; and such, these are the keyboard commands; &#8220;^&#8221; means &#8220;Ctrl-&#8221;.</p>
						</div>
						<div class="reply">
							<a class='comment-reply-link' href='/1/wordpress/2010/09/hello-world/?replytocom=58#respond' onclick='return addComment.moveForm("comment-58", "58", "respond", "1")'>Reply</a> 
						</div><!-- .reply -->
					</div><!-- #comment-##  -->
				
</li>
</ul>
</li>
 
			</ol>
								<div id="respond">
				<h3 id="reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/1/wordpress/2010/09/hello-world/#respond" style="display:none;">Cancel reply</a></small></h3>
									<form action="http://lukeshu.ath.cx/1/wordpress/wp-comments-post.php" method="post" id="commentform">
																			<p class="comment-notes">Your email address will not be published. Required fields are marked <span class="required">*</span></p>							<p class="comment-form-author"><label for="author">Name</label> <span class="required">*</span><input id="author" name="author" type="text" value="" size="30" aria-required='true' /></p>
<p class="comment-form-email"><label for="email">Email</label> <span class="required">*</span><input id="email" name="email" type="text" value="" size="30" aria-required='true' /></p>
<p class="comment-form-url"><label for="url">Website</label><input id="url" name="url" type="text" value="" size="30" /></p>
												<p class="comment-form-comment"><label for="comment">Comment</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>						<p class="form-allowed-tags">You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:  <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></p>						<p class="form-submit">
							<input name="submit" type="submit" id="submit" value="Post Comment" />
							<input type='hidden' name='comment_post_ID' value='1' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
						</p>
											</form>
							</div><!-- #respond -->
						 
		</div><!-- #comments -->
 
	</div>
<div class='footer'><a class='nocss' id='footer'></a>
	<div class="site-generator">
		<a href="http://wordpress.org/" title="Semantic Personal Publishing Platform" rel="generator" class="site-generator">Powered by WordPress.</a>
	</div>
<p class="valid">Valid <a                href="http://validator.w3.org/check?uri=http%3A%2F%2Flukeshu.ath.cx%2F1%2Fwordpress%2Findex.php" id="link_validate_html">XHTML</a>
                 and   <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Flukeshu.ath.cx%2F1%2Fwordpress%2Findex.php" id="link_validate_css" >CSS</a>.
                 <br /><a href="/0/wordpress/index.php">Show (server side) source</a>
</p>
  <p class='copyright'>Copyright &copy; 2010, 2011 Luke Shumaker</p>
  <p class='license'>Verbatim copying and distribution of
    this entire article are permitted worldwide, without
    royalty, in any medium, provided this notice, and the
    copyright notice, are preserved.</p>
</div>
 
</body>
</html>