Shell Builtin Functions

autoexec.m declares a number of function for interactive use. Most are just wrappers around existing functions, to avoid typing longer names. With these functions, files on the phone can be easily manipulated:

// list all JPG files on the current drive
dir \*.jpg/r/l
→ -- 05-08-09  2966 \documents\mShell\GraphTest.jpg
-- 11:37:02 17909 \Nokia\Images\FE_img\FEscr(0).jpg
...
// copy the JPG files in \documents\mShell to drive e:
cp \documents\mShell\*.jpg e:
→ 1
// search for the mShell properties file
dir \*.prp/r
→ \System\Apps\mShell\mShell.prp
// show its contents
type \system\apps\mShell\mShell.prp
→ mfont=LatinPlain12
outsize=20000
keep=busy

If a customized autoexec.m in system.docdir is created without incorporating the original script, these function are no longer available.

.cp

• function cp(src, dst, recursive=false) → Number
    /r:recursive

Copies a file, files matching a pattern, or an entire directory tree. Wrapper for files.copy.

.del

• function del(pattern, recursive=false) → Number
    /r:recursive

Deletes a file, files matching a pattern, also in complete directory tree. Wrapper for files.delete.

.dir

• function dir(pattern="*", recursive=false, long=false, hidden=false, modified=0) → null
    /h:hidden
    /l:long
    /m:modified
    /r:recursive

List files matching pattern on standard output. If pattern is a directory, lists all files in it. Options are the following:

.edit

• function edit(name) → null

Loads a file into the builtin editor and shows it. Wrapper for files.edit.

.exit

• function exit() → null

Exit this shell. This is equivalent to closing it. This function is only available if module proc is available.

.md

• function md(path, all=false) → Number
    /a:all

Creates a directory or directories. Wrapper for files.mkdir.

.mv

• function mv(src, dst, recursive=false) → Number
    /r:recursive

Moves a file, files matching a pattern, or an entire directory tree. Wrapper for files.move.

.rd

• function rd(path, recursive=false) → Number
    /r:recursive

Removes a directory or an entire directory tree. Wrapper for files.rmdir.

.ren

• function ren(old, new) → Number

Renames a single file. Wrapper for files.rename.

.run

• function run(script, show=false) → null
    /s:show

Run another m script. If show=true, the script's console is shown. This function is only available if module proc is available.

.send

• function send(name, subject=null) → null

Interactively sends a file over a channel chosen by the user. Wrapper for files.send.

.type

• function type(file, utf16=false, tail=false) → null
    /u:utf16
    /t:tail

Writes the contents of file to standard output.

If utf16=true, assumes the file to be UTF-16 little endian encoded. Otherwise, raw encoding is assumed.

If tail=true, only outputs the last 300 bytes. If tail=n where n is a number, outputs the last n bytes.


© 2004-2010 airbit AG, CH-8008 Zürich
Document AB-M-REF-869