Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: sh - Constructor Up: misc - Module Previous: faq - Function


sh - Tool



Package utility
Module misc


Postscript file available

A persistent shell client

include "sh.g"

Constructors
sh Construct persistent shell client tool
Functions
command execute command
done destroy the tool



Description

The sh class allows the user to create persistent instances of a shell client, so that the overhead of creating the client can be amortized over many different function calls. This can result in a considerable time savings for functions that iterate over, say, files in a directory. Unlike shellcmd, this is really meant for fairly low level use and there is no logging option. This might be fixed later, if there is demand for it.



Example
- mysh := sh()                      # create the client
- mysh
[command=<function>, done=<function>] 
- mysh.command('ls -1')             # The basic use
                                    # output in .lines
[lines=Glish.txt MS NUAGES_SOLARIS News Rapport.ps Refman.ps aips++ aipsvars
 aipsviewrc.list bin catalog.g catalogsink.g displaylistbox.g foo.g foo.ps
 gcal glish.comments ... , status=0, errlines=]
- mysh.command('ls sfajlds')        # stderr in .errlines
                                    # status in .status
[lines=, status=2, errlines=sfajlds: No such file or directory] 
- mysh.command('jasdfjls')
[lines=, status=1, errlines=] 
- files:=mysh.command('ls -1').lines  # typical composite use
- length(files)
63 
- mysh.done()                     # must be killed explicitly




next up previous contents index
Next: sh - Constructor Up: misc - Module Previous: faq - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15