<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thanks Derek, I modified your command line as <br><br>echo -e "macro ../sac_cut.macro \n exit" | sac<br><br>and still get the same error: <br>SAC> readline: readline_callback_read_char() called with no handler!<br>Aborted (core dumped)<br>cd: 25: can't cd to sac_cut.macro<br><br>I am thinking macro isn't seen as a command within sac by echo. <br><br>Thanks again!<br><br><div style="color: rgb(162, 162, 162);"><strong><font style="font-style: italic;" size="2"><font class="Apple-style-span" face="garamond, 'new york', times, serif">Serenity isn't freedom from the storm, but peace within the storm</font></font><font class="Apple-style-span" face="garamond, 'new york', times, serif"><br></font></strong></div> <div style="color: rgb(162, 162, 162);"><font size="2"><strong><font class="Apple-style-span" face="garamond, 'new york', times, serif">Januka
Attanayake </font></strong></font></div> <div style="color: rgb(162, 162, 162);"><font size="2"><strong><font class="Apple-style-span" face="garamond, 'new york', times, serif">Global Seismology & Economics<br>The University of Connecticut <br>Beach Hall - U2045<br>354, Mansfield Rd; <br>Storrs, CT 06269<br></font></strong></font><font size="2"><strong style="font-weight: bold;"><font class="Apple-style-span" face="garamond, 'new york', times, serif">Tel : 860 486 0475 (Office)<br> </font></strong><strong style="font-weight: bold;"><font class="Apple-style-span" face="garamond, 'new york', times, serif"> 860 486 3914 (Lab - P405)<br></font></strong></font></div> <div style="color: rgb(134, 135, 164); font-family: times new roman,new york,times,serif;"><font size="2"><span style="color: rgb(139, 139, 139); font-weight: bold;"><font class="Apple-style-span" face="garamond, 'new york',
times, serif">URL: </font><a rel="nofollow" target="_blank" href="http://sites.google.com/site/janukaattanayake/"><font class="Apple-style-span" face="garamond, 'new york', times, serif">http://sites.google.com/site/janukaattanayake/</font></a></span></font><div><font class="Apple-style-span" color="#a2a2a2"><br></font><br><br><br><br></div></div><br><br>--- On <b>Mon, 10/25/10, Derek Schutt <i><Derek.Schutt@colostate.edu></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Derek Schutt <Derek.Schutt@colostate.edu><br>Subject: Re: [SAC-HELP] calling sac commands within shell scripts<br>To: sac-help@iris.washington.edu, jattanayake@gmail.com<br>Date: Monday, October 25, 2010, 12:31 PM<br><br><div id="yiv1391050839">
Hi Januka,<br>
<br>
Here's one way to do it. This is from a bash script that invokes
sac to change the "a" and "f" headers:<br>
<br>
echo -e "r $sacfile \n ch a $a_time \n ch F $F_time \n wh \n exit" |
sac<br>
<br>
I'd bet there are much more elegant ways to do it too. <br>
<br>
-Derek<br>
<br>
<br>
On 10/25/2010 10:20 AM, Januka Attanayake wrote:
<blockquote type="cite">Greetings, <br>
I am trying to call sac within a shell script as follows. <br>
<br>
while read line<br>
do<br>
cd $line<br>
<br>
sac<br>
gawk '{print "macro ../sac_cut.macro"}'<br>
<br>
cd ../<br>
done < folder_list.txt <br>
<br>
<br>
folder_list.txt holds the names of all the directory names that
the script is suppose to look in. <br>
I see that sac is initiated but the problem is in executing
commands within sac once it is initiated. I have tried several
ways of doing that including printf and piping to sac with back
quotes. Still I get the following error. <br>
<br>
SAC> readline: readline_callback_read_char() called with no
handler!<br>
<br>
How should one execute sac commands within a shell script? <br>
<br>
I am using sac Version 101.3b<br>
<br>
Thanks a lot.<br>
<br>
Januka.<br>
<pre><fieldset class="yiv1391050839mimeAttachmentHeader"></fieldset><br>_______________________________________________<br>sac-help mailing list<br><a rel="nofollow" class="yiv1391050839moz-txt-link-abbreviated" ymailto="mailto:sac-help@iris.washington.edu" target="_blank" href="/mc/compose?to=sac-help@iris.washington.edu">sac-help@iris.washington.edu</a><br><a rel="nofollow" class="yiv1391050839moz-txt-link-freetext" target="_blank" href="http://www.iris.washington.edu/mailman/listinfo/sac-help">http://www.iris.washington.edu/mailman/listinfo/sac-help</a><br></pre>
</blockquote>
<br>
<br>
<pre class="yiv1391050839moz-signature">-- <br>--------------------<br>Derek Schutt<br>Assistant Professor<br>Geosciences Department<br>309 Natural Resources Building<br>Campus Delivery 1482<br>Fort Collins, CO 80525-1482<br><a rel="nofollow" class="yiv1391050839moz-txt-link-freetext" target="_blank" href="http://warnercnr.colostate.edu/%7Eschutt/CSU_web/index.htm">http://warnercnr.colostate.edu/~schutt/CSU_web/index.htm</a><br>970-491-5786<br></pre>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>sac-help mailing list<br><a ymailto="mailto:sac-help@iris.washington.edu" href="/mc/compose?to=sac-help@iris.washington.edu">sac-help@iris.washington.edu</a><br><a href="http://www.iris.washington.edu/mailman/listinfo/sac-help" target="_blank">http://www.iris.washington.edu/mailman/listinfo/sac-help</a><br></div></blockquote></td></tr></table><br>