[SAC-HELP] calling sac commands within shell scripts

Derek Schutt Derek.Schutt at colostate.edu
Mon Oct 25 09:31:17 PDT 2010


  Hi Januka,

Here's one way to do it.   This is from a bash script that invokes sac 
to change the "a" and "f" headers:

echo -e "r $sacfile \n ch a $a_time \n ch F $F_time \n wh \n exit" | sac

I'd bet there are much more elegant ways to do it too.

-Derek


On 10/25/2010 10:20 AM, Januka Attanayake wrote:
> Greetings,
> I am trying to call sac within a shell script as follows.
>
> while read line
> do
>     cd $line
>
>         sac
>         gawk '{print "macro ../sac_cut.macro"}'
>
>     cd ../
> done < folder_list.txt
>
>
> folder_list.txt holds the names of all the directory names that the 
> script is suppose to look in.
> 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.
>
> SAC> readline: readline_callback_read_char() called with no handler!
>
> How should one execute sac commands within a shell script?
>
> I am using sac Version 101.3b
>
> Thanks a lot.
>
> Januka.
>
>
> _______________________________________________
> sac-help mailing list
> sac-help at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/sac-help


-- 
--------------------
Derek Schutt
Assistant Professor
Geosciences Department
309 Natural Resources Building
Campus Delivery 1482
Fort Collins, CO 80525-1482
http://warnercnr.colostate.edu/~schutt/CSU_web/index.htm
970-491-5786

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.iris.washington.edu/pipermail/sac-help/attachments/20101025/8f6342cf/attachment.html>


More information about the sac-help mailing list