<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel>
	  <title>Ask MetaFilter questions tagged with shellscript</title>
      <link>http://ask.metafilter.com/tags/shellscript</link>
      <description>Questions tagged with 'shellscript' at Ask MetaFilter.</description>
	  <pubDate>Thu, 01 May 2008 07:59:40 -0800</pubDate> <lastBuildDate>Thu, 01 May 2008 07:59:40 -0800</lastBuildDate>

      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>	  
	<item>
	<title>I can haz sitemap?</title>
	<link>http://ask.metafilter.com/90271/I%2Dcan%2Dhaz%2Dsitemap</link>	
	<description>How can I print the directory structure of my website? I&apos;ve seen &lt;a href=&quot;http://ask.metafilter.com/34104/How-do-I-print-a-drives-directory-structure&quot;&gt;this question&lt;/a&gt;, and mine is similar, except I would like to do it over an FTP connection, if possible.&lt;br&gt;
&lt;br&gt;
I work on the web team for a small, liberal-arts college. Our site has gotten unmanageably large, and we would like to create an *actual* sitemap (we have a sitemap, but the actual server has much much more than it technically should).  I&apos;ve considered just FTPing the whole site to a local machine, and running the dos TREE command, but it doesn&apos;t sort alphabetically, and we&apos;re talking about FTPing a LOT of stuff (like, it would take a day or so to do the transfer).&lt;br&gt;
&lt;br&gt;
The site is running on IIS6 on a Win2K3 box (I know, I know...) so I can&apos;t really take advantage of some of the unix commands designed to do specifically what I want.  And I don&apos;t believe TREE ships with Win2K3 (and even if it did, I can&apos;t use it, since it doesn&apos;t sort alphabetically).&lt;br&gt;
&lt;br&gt;
What are my options here?</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2008:site.90271</guid>
	<pubDate>Thu, 01 May 2008 07:59:40 -0800</pubDate>
	<category>ftp</category>
	<category>iis</category>
	<category>shellscript</category>
	<category>sitemap</category>
	<category>tree</category>
	<category>win2k3</category>
	<dc:creator>fvox13</dc:creator>
	</item>
	<item>
	<title>Scripting the parallel execution of a tedious task</title>
	<link>http://ask.metafilter.com/52998/Scripting%2Dthe%2Dparallel%2Dexecution%2Dof%2Da%2Dtedious%2Dtask</link>	
	<description>Calling all shell script gurus! Help me write a command that performs an action on items in a list in parallel (as opposed to sequentially). I am trying to write a command that zeroes out the data on any number of attached disks simultanously (or nearly so). I started with the basics and have written the script below that accomplishes the task sequentially. (This is in Mac OS X, bash shell):&lt;br&gt;
&lt;code&gt;&lt;br&gt;
diskutil list | grep /disk | grep -v disk0 | sed &apos;s|/dev/||g&apos; | \&lt;br&gt;
while read DISK; do&lt;br&gt;
diskutil zeroDisk $DISK&lt;br&gt;
done&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
The first line returns a list of attached disks:&lt;br&gt;
disk1&lt;br&gt;
disk2&lt;br&gt;
disk3&lt;br&gt;
etc... all except disk0.&lt;br&gt;
&lt;br&gt;
Nothing I care about resides on any disk but disk0, which is why it&apos;s excluded. The while loop executes the &apos;diskutil zerodisk&apos; command on each item in the list. I can manually start this command on each disk and the computer will happily perform the tasks in parallel. How can I script the parallel execution of this task?</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2006:site.52998</guid>
	<pubDate>Tue, 12 Dec 2006 12:03:01 -0800</pubDate>
	<category>mac</category>
	<category>scripting</category>
	<category>shell</category>
	<category>shellscript</category>
	<category>unix</category>
	<dc:creator>pmbuko</dc:creator>
	</item>
	<item>
	<title>bash bash bash</title>
	<link>http://ask.metafilter.com/43945/bash%2Dbash%2Dbash</link>	
	<description>Calling all bash/nix gurus.. please help me! I have a list of users that I&apos;m trying to parse and convert into a html-friendly format, surrounding them around &amp;lt;option&amp;gt; tags so I can put them in an HTML select form.&lt;br&gt;
&lt;br&gt;
I&apos;m getting input from /etc/passwd, grepping to find users that are enabled login, cutting and getting the first segment before a colon, and sorting in alphabetical order -- then surrounding the resulting list of login IDs in option tags:&lt;br&gt;
&lt;br&gt;
&lt;tt&gt;cat /etc/passwd | egrep &quot;\[N?U&quot; | cut -d : -f 1 | sort | sed -n &apos;s/.*/&amp;lt;option value=\&quot;&amp;amp;\&quot;&amp;gt;&amp;amp;&amp;lt;\/option&amp;gt;&lt;/tt&gt;&lt;br&gt;
&lt;br&gt;
Which yields:&lt;br&gt;
&amp;lt;option value=&quot;loginID1&quot;\&amp;gt;loginID1&amp;lt;/option\&amp;gt;&lt;br&gt;
,etc.&lt;br&gt;
&lt;br&gt;
That&apos;s all fine, not a problem. &lt;b&gt;But -- &lt;/b&gt; now I want to run each ID through &apos;lookup&apos; and grep the name out, and then insert between the option tags, where the second ampersand is, like this:&lt;br&gt;
&lt;br&gt;
&amp;lt;option value=&quot;loginID1&quot;&amp;gt;Firstname Lastname1&amp;lt;/option&amp;gt;&lt;br&gt;
&lt;br&gt;
Assuming that &lt;tt&gt;lookup loginID1&lt;/tt&gt; returns &lt;tt&gt;Firstname Lastname 1&lt;/tt&gt;, how can I do this? It seems that I need to keep the original values of the /etc/password - parsed values while also running them through lookup. Is there any way I can do this in one line, without having to resort to loops/arrays in bash? Or will an in-line Perl script help? &lt;br&gt;
&lt;br&gt;
Thanks!</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2006:site.43945</guid>
	<pubDate>Tue, 08 Aug 2006 13:03:24 -0800</pubDate>
	<category>bash</category>
	<category>nix</category>
	<category>shellscript</category>
	<dc:creator>provolot</dc:creator>
	</item>
	<item>
	<title>Make my Mac beep me when it&apos;s finished.</title>
	<link>http://ask.metafilter.com/37983/Make%2Dmy%2DMac%2Dbeep%2Dme%2Dwhen%2Dits%2Dfinished</link>	
	<description>Help me make my other Mac, in the other room, beep me when an app has finished what it&apos;s doing. I have two Macs. The one in the living room is for browsing. The other one, down the hall, is where I do things like burning DVDs. It&apos;s not online.&lt;br&gt;
&lt;br&gt;
So, if burning a DVD takes 20 minutes or so, I forget about it. A couple of hours later I remember and start burning the next one. So about an hour&apos;s work can take all day. And I can&apos;t be forever walking down the hall to see how it&apos;s going.&lt;br&gt;
&lt;br&gt;
So, there must be some way I can run a script which monitors &lt;strong&gt;ps&lt;/strong&gt; or &lt;strong&gt;top&lt;/strong&gt; or something, right? &lt;br&gt;
&lt;br&gt;
Every minute it could check and if Disk Utility&apos;s CPU usage was at 0.00%, then it&apos;s finished. And the computer would start quietly beeping. There&apos;s still some BELL character you can print to make it beep, right? Am I going to have problems with false positives, readings of zero for a split second?&lt;br&gt;
&lt;br&gt;
For all I know there&apos;s actually shiny-GUI software which will do this, but I&apos;ve never heard of it and can&apos;t think how to search. And I don&apos;t need it. I&apos;ll happily start the app, then type &lt;br&gt;
&lt;br&gt;
&lt;pre&gt;beepwhenfinished &apos;Disk Utility&apos;&lt;/pre&gt; &lt;br&gt;
&lt;br&gt;
or something.</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2006:site.37983</guid>
	<pubDate>Thu, 11 May 2006 03:59:27 -0800</pubDate>
	<category>apple</category>
	<category>beep</category>
	<category>mac</category>
	<category>monitor</category>
	<category>perl</category>
	<category>ps</category>
	<category>shellscript</category>
	<category>top</category>
	<dc:creator>AmbroseChapel</dc:creator>
	</item>
	
	</channel>
</rss>

