command-line use on OS X
Rodney Tamblyn
rodneytamblyn at paradise.net.nz
Tue Aug 26 19:27:01 EDT 2003
Hi Dar,
If you are looking for a simple and basic text editor from the command
line, try pico...
pico myfile.txt
The commands inside are self explanatory.
You can also execute stacks from the commandline. Eg Make a Revolution
stack, in the stack script put an "on libraryStack" handler. The end
of this handler should "put" something, ie whatever you want to return.
Then create a script file in the same directory as the stack (for
simplicity).
eg
on libraryStack
put "hello world"
end libraryStack
In script file
#!/usr/local/bin/revolution (or whereever your revolution is)
on startup
library "mystack.rev"
end startup
You can have the stack open in Revolution and still execute it from the
command line, so you can carry on editing etc in Revolution. The
advantage is that you get to test the script (eg debugging, compile
errors when closing script editor), not to mention ability to organise
code, use libraries etc
Some Unix commands you may find useful:
To execute last command again: !!
This is very useful when you execute a command, but needed to do it as
root, rather than typing it again you can do: su !!
Also, you can execute previous commands from the history by supplying
first few letters. So if you had previously used command "pico
mytext.mc", later on you could type !pic or even !p and it would find
the command in your history starting with those letters and execute it.
pushd and popd
If you are going to another directory and want to be able to return
easily to where you are, you can push the current location onto a
stack, and later pop it back off. eg
pushd /usr/local/bin
....
popd (returns you to first location)
chmod 777 filename t
Makes a file executable.
Regards,
Rodney
On Wednesday, August 27, 2003, at 09:58 AM, Dar Scott wrote:
> I downloaded the Darwin engine and I can do this:
>
> ./mc helloworld.txt
>
> In this form, the text file does not seem to need #!.
>
> This engine seems bloated; it is well over 2MB. X11?
>
> I seem to have forgotten most of what I know of unix from a quarter
> century ago.
>
> I don't need cgi (yet). I just want to do some command-line work.
> Does this file (mc) go into /etc/bin or some other directory? What
> permissions and ownership should it have.
>
> I'm currently editing with TextEdit. I am not able to type the text
> file name to the terminal just as I would a program. I get a
> permissions error. Do I need to make it executable? TextEdit does
> not make files executable. The "get info" does not have an execute
> option on permissions. Do I need to go in and chmod each file? Maybe
> I need to make an editor with Revolution.
>
> I suspect I'm missing the obvious.
>
> Even though I'm an old school lisp guy, I don't emacs and I had a
> hypnotist purge all knowledge of vi years ago. I think I did; I don't
> remember vi, anyway.
>
> Dar Scott
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
--
Rodney Tamblyn
44 Melville Street
Dunedin
New Zealand
+64 3 4778606
http://rodney.weblogs.com/
More information about the use-livecode
mailing list