[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Command Line Interaction

SparForte supports all modern terminal or console windows, including the Linux text console, KDE's konsole, the Gnome console and most monochrome terminal emulations that cursor movement. Support for inverse and bold print is preferred.

Command Line Key Bindings

With SparForte 2.0, the language now uses the GNU readline library to handle command line key sequences. See the GNU readline documentation for additional information about what editing keys are supported, or how to customize your keys.

Non-Readline Command Line Key Bindings

If you decide not to use GNU readline, you can use the old SparForte command line input functions. SparForte recognizes the Linux console arrow keys and common key sequences for the "emacs" and "vi" text editors. The sequences are called key bindings and represent cursor movement and editing functions.

The emacs mode key bindings are:

  • control-b - move back (left) one character
  • control-f - move forward (right) one character
  • control-p - move to the previous command line you typed
  • control-n - move to the next command line you typed
  • control-x - erase the command line
  • control-a - move to start of the line
  • control-e - move to end of the line
  • control-r - search command lines (history) backwards
  • control-u - delete under cursor (SparForte addition)
  • control-] - character search forwards. (Follow with the key to search for.)
  • tab - complete the filename
  • backspace/delete - delete a character

If you prefer to use vi cursor movement instead, press the escape key to enter vi mode. Press escape again to return to emacs mode. In vi mode, you can use lower-case 'h', 'j', 'k', 'l', 'x' (delete under cursor), '^' and '$'. Filename completion is accomplished with two escape key presses in a row.

Command History

SparForte remembers up to 100 command lines for the current session, and you can cycle through them using control-p and control-n. The history command will show your command history.

Filename Completion

Pressing a tab (or ESC twice) on the command line will cause SparForte to search for filenames to complete a command.

If there are multiple matches, SparForte will complete as much of the filename as matches all cases. Pressing tab again will show a list of the possible matches. A maximum of 10 are shown. If there are 10 or more matches in the list, the message "[Maybe More]" is shown.

If the filename contains a leading tilde, it will be treated as the path to your home directory.

SIGINT Handling

Typing a control-c (sending a SIGINT signal) at the command prompt acts the same as a control-x.  Pressing control-c while a script or command is running will cause it to stop.

Interactive Sessions versus Scripts

Interactive sessions have the following limitations or features:

  • The final semi-colon is optional.  If it is missing, SparForte will append a semi-colon before executing the command.  (If an error occurs, the entire line will be shown, including the extra semi-colon.)  Semi-colons will have to be placed after every command except the final command.
    => ? "hello"
    hello
    => ? "hello";
    hello
    
  • Compound statements (statements that enclose other statements) can be used provided that the complete statement appears on a single line.
    => for i in 1..5 loop put_line( i ) ; end loop
    1
    2
    3
    4
    5
    
  • During an assignment, if the variable being assigned isn't declared, it's automatically declared unless pragma ada_95 or pragma restriction( no_auto_declarations ) is used. The type of the variable is the type of the expression being assigned.
    => i := 5
    => (Assuming i is a new universal_numeric variable)
    
  • External commands can be grouped into pipelines using the vertical bar character (|).  Pipelines are a command line convenience feature and are not intended for use in scripts (this is true in other Linux shells as well).
  • The typeset and unset commands can only be used in an interactive session.
  • Interactive login sessions can only be terminated with the logout command.


   
[Right Submenu]

 AdaScript versus GCC

 Case Sensitivity

 Reserved Words

 Comments

 Literals

 Bourne Shell Word Expansions

 Fundamental Types

 User-defined Types

 Enumerated Types

 Arrays

 Records

 Basic Assignment

 The @ and % Operands

 Command Argument Shortcuts

 Redirection and Pipelines

 Command Line Interaction

 Built-in Shell Commands

 The Current Directory

 Database Commands

 Flow of Control

 Other Statements/ Subprograms

 External Commands

 Block Statements and Subprograms

 TCP/IP Sockets

 Numeric Formatting with Put

 Interpreter Directives

 Command Line Options

 Command Reference

 ASCII and Latin_1 Character Sets

 Common Error Messages

 Common PHP Functions and the SparForte Equivalent

[Back to Top] Back To Top [Small Forte Symbol]