MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


User Commands                                             SLSH(1)



NAME
     slsh - Interpreter for S-Lang scripts

SYNOPSIS
     slsh [ --help ] [ --version ] [ -g ] [ -n ] [ --init file  ]
     [  --no-readline  ]  [  -e  string  ] [ -i ] [ -t ] [ -v ] [
     -script-file args... ]


DESCRIPTION
     slsh is a simple program for  interpreting  S-Lang  scripts.
     It supports dynamic loading of S-Lang modules and includes a
     readline interface for interactive use.

OPTIONS
     --help
          Show a summary of options

     --version
          Show slsh version information

     -g   Compile with debugging code, tracebacks, etc

     -n   Don't load the personal initialization file

     --init file
          Use this file instead of ~/.slshrc

     --no-readline
          Do not use a readline  interface  for  the  interactive
          mode

     -e string
          Execute ``string'' as S-Lang code.

     -i   Force interactive mode.  Normally  slsh  will  go  into
          interactive  mode if both stdin and stdout are attached
          to a terminal.

     -t   Normally, slsh will call slshmain if  it  is  defined.
          This option prevents that from happening making it use-
          ful for checking for syntax error.

     -v   Show verbose loading messages.  This is useful for see-
          ing what files are being loaded.

INITIALIZATION
     Upon startup, the program will try to load slsh.rc  as  fol-
     lows.  If  either  SLSHCONFDIR or SLSHLIBDIR environment
     variables exist, then slsh will look look in the correspond-
     ing directories for slsh.rc.  Otherwise it will look in:




SunOS 5.10       Last change: 08 September 2007                 1






User Commands                                             SLSH(1)



     $(prefix)/etc/   (as specified in the Makefile)

     /usr/local/etc/

     /usr/local/etc/slsh/

     /etc/

     /etc/slsh/

     The slsh.rc file may load other files  from  slsh's  library
     directory in the manner described below.

     Once slsh.rc has been loaded, slsh will  load  $HOME/.slshrc
     if  present.   Finally, it will load the script specified on
     the command line.  If the name of the script is -,  then  it
     will be read from stdin.  If the script name is not present,
     or a string to  execute  was  not  specified  using  the  -e
     option,  then  slsh  will  go into interactive mode and read
     input from the terminal.   If  the  script  is  present  and
     defines  a  function called slshmain, that function will be
     called.

LOADING FILES
     When a script loads a file via the built-in  evalfile  func-
     tion  or  the  require function (autoloaded by slsh.rc), the
     file is searched for along the SLSHPATH as specified in the
     Makefile.   An  alternate  path  may  be  specified  by  the
     SLSHPATH environment variable.

     The search path may be queried and set during run  time  via
     the  getslangloadpath  and setslangloadpath functions,
     e.g.,

        setslangloadpath ("/home/bill/lib/slsh:/usr/share/slsh");

INTERACTIVE MODE
     When slsh is invoked without a script or  is  given  the  -i
     command  line  argument,  it  will  go into into interactive
     mode.  In this mode, the user will be  prompted  for  input.
     The  program will leave this mode and exit if it sees an EOF
     (Ctrl-D) or the user exits by issuing the quit command.

     If an uncaught exception occurs during execution of  a  com-
     mand,  the  error message will be shown and the user will be
     prompted for more input.

     Any objects left on  the  stack  after  a  command  will  be
     printed  and the stack cleared.  This makes interactive mode
     useful as a calculator, e.g.,

          slsh> 3*10;



SunOS 5.10       Last change: 08 September 2007                 2






User Commands                                             SLSH(1)



          30
          slsh> x = [1:20];
          slsh> sum (sin(x)-cos(x));
          0.458613
          slsh> quit;
     Note  that  in  this  mode,  variables   are   automatically
     declared.

     The interactive mode also supports command logging.  Logging
     is enabled by the startlog function.  The stoplog function
     will turn off  logging.   The  default  file  where  logging
     information will be written is slsh.log.  An alternative may
     be specified as an optional argument to the startlog  func-
     tion:

          slsh> startlog;
          Logging input to slsh.log
             .
             .
          slsh> stoplog;
          slsh> startlog("foo.log");
          Logging input to foo.log
             .
             .
          slsh> stoplog;
          slsh> startlog;
          Logging input to foo.log

     Similarly, the saveinput function may be used to  save  the
     previous input to a specified file:

          slsh> saveinput;
          Input saved to slsh.log
          slsh> saveinput ("foo.log");
          Input saved to foo.log

     As the above examples indicate, lines must end  in  a  semi-
     colon.   This is a basic feature of the language and permits
     commands to span multiple lines, e.g.,

          slsh> x = [
                 1,2,3,
                 4,5,6];
          slsh> sum(x);
     For convenience some users prefer that commands be automati-
     cally  terminated  with  a  semicolon.   To have a semicolon
     silently appended to the end of an input line, put the  fol-
     lowing in $HOME/.slshrc file:

         #ifdef INTERACTIVE
         slshappendsemicolon (1);
         #endif



SunOS 5.10       Last change: 08 September 2007                 3






User Commands                                             SLSH(1)



     The interactive mode also supports shell escapes.  To pass a
     command to the shell, prefix it with !, e.g.,

         slsh> !pwd
         /grandpa/d1/src/slang2/slsh
         slsh> !cd doc/tm
         slsh> !pwd
         /grandpa/d1/src/slang2/slsh/doc/tm

     Finally, the interactive mode supports a  help  and  apropos
     function:

         slsh> apropos list
         apropos list ==>
         ListType
         listappend
         listdelete
            .
            .
         slsh> help listappend
         listappend

          SYNOPSIS
            Append an object to a list

          USAGE
            listappend (ListType, object, IntType nth)
            .
            .
     For convenience, the  help  and  apropos  functions  do  not
     require the syntactic constraints of the other functions.

MISCELANEOUS SCRIPTS
     Several   useful   example   scripts    are    located    in
     $prefix/share/slsh/scripts/,  where  $prefix  represents the
     slsh  installation  prefix  (/usr,  /usr/local,...).   These
     scripts include:

     sldb A script that runs the S-Lang debugger.

     jpegsize
          Reports the size of a jpeg file.

     svnsh
          A shell for browsing an SVN repository.

AUTHOR
     The  principal   author   of   slsh   is   John   E.   Davis
     .   The  interactive  mode  was provided by
     Mike Noble .  The S-Lang library  upon
     which  slsh  is based is primarily the work of John E. Davis
     with help from many others.



SunOS 5.10       Last change: 08 September 2007                 4






User Commands                                             SLSH(1)



     This manual page was originally written  by  Rafael  Labois-
     siere   for the Debian system (but may be
     used by others).

     Permission is granted to copy, distribute and/or modify this
     document  under the terms of the GNU General Public License,
     Version 2 any later version published by the  Free  Software
     Foundation.

     On Debian systems, the complete text of the GNU General Pub-
     lic License can be found in /usr/share/common-licenses/GPL

ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     
       ATRIBUTE TYPE     ATRIBUTE VALUE
    
     Availability         SUNWslang      
    
     Interface Stability  Volatile       
    

NOTES
     Source for slang is available on http:/opensolaris.org.





























SunOS 5.10       Last change: 08 September 2007                 5



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™