RunRev and Linux Shell Scripting (...was Re: Record Audio in Rev on Linux OS?)

John Patten johnpatten at
Fri Apr 23 13:18:25 EDT 2010

Thanks Peter!!!

This was just the information I was looking for!

John Patten

Date: Thu, 22 Apr 2010 23:39:17 -0800 (PST)
From: Peter Alcibiades <palcibiades-first at>
Subject: Re: Record Audio in Rev on Linux OS?
To: use-revolution at
Message-ID: < at>
Content-Type: text/plain; charset=us-ascii

Invoking the shell command is the easy part.  First, you open a  
terminal and
verify that the command or script you want to use works properly from  
terminal.  For example, if you are going to use krecord you would open a
terminal and do


followed by whatever options you want.

(this seems to be the command which opens the app now, seems to me it  
to be krecord but still.....)

Now you know that it works as expected in the shell, you can invoke it  

     put shell("krec")   -- this will just open the application.

For instance, to execute the command you gave as a sample, from a  
you would just do:

     on mouseUp
     put shell("arecord -d 10 -f cd -t wav -D copy foobar.wav")
     end mouseUp

This would then record the file in the user's home directory as  

You can execute any shell command like this.

You can also pipe the output of one shell command to the input of  
one, in a shell command, as in

     ls | gedit

this will have the effect of first listing the current directory  
then sending the result to gedit, in which the input will be opened.   
could use this to send a file, once recorded, to a player.  Or, if you  
lame installed, you could use it to convert the file to mp3 with

Finally, you might need to execute commands one after the other, which  
can also do.  To do this, you put your script into a file, for example,, have the first line be a so called 'shebang', make it
executable, and put in your commands one after the other.  Lets say you
wanted the file in the above example to go to the desktop:

     #! /usr/bin/env bash
     cd Desktop
     arecord -d 10 -f cd -t wav -D copy foobar.wav

Now you would do, from your button,

     put shell (     -- the file would have to be made

The shell is a quite fully featured, if rather antique, programming
language, with what you might regard as a huge collection of macros and
utilities for all kinds of purposes.  Most of the stuff you would  
flow control, branching, error reporting etc.   There are lots of  
guides to
it on the net, but if you're in an academic environment the simplest  
be to find someone in IT who has scripting experience and have them  
it.  If you want to learn it yourself, there is a nice book, full of  
examples, by Glen Smith:  Introduction to Shell Scripting.  Might be a  
basic for an experienced programmer.

It is antique, but its ideal for this sort of thing, because of the  
to invoke stuff like krec.  On Rev, because of the limitations of Rev on
Linux at the moment, its a lifesaver.


View this message in context:
Sent from the Revolution - User mailing list archive at


More information about the Use-livecode mailing list