[SAC-HELP] calling sac commands within shell scripts

Januka Attanayake jattanayake at yahoo.com
Mon Oct 25 09:50:03 PDT 2010


Thanks Derek, I modified your command line as 

echo -e "macro ../sac_cut.macro \n exit" | sac

and still get the same error: 
SAC> readline: readline_callback_read_char() called with no handler!
Aborted (core dumped)
cd: 25: can't cd to sac_cut.macro

I am thinking macro isn't seen as a command within sac by echo. 

Thanks again!

Serenity isn't freedom from the storm, but peace within the storm
  Januka Attanayake   Global Seismology & Economics
The University of Connecticut 
Beach Hall - U2045
354, Mansfield Rd; 
Storrs, CT 06269
Tel :  860 486 0475 (Office)
          860 486 3914 (Lab - P405)
    URL: http://sites.google.com/site/janukaattanayake/






--- On Mon, 10/25/10, Derek Schutt <Derek.Schutt at colostate.edu> wrote:

From: Derek Schutt <Derek.Schutt at colostate.edu>
Subject: Re: [SAC-HELP] calling sac commands within shell scripts
To: sac-help at iris.washington.edu, jattanayake at gmail.com
Date: Monday, October 25, 2010, 12:31 PM



  

    
  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

  

-----Inline Attachment Follows-----

_______________________________________________
sac-help mailing list
sac-help at iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/sac-help



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


More information about the sac-help mailing list