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

Built-in Shell Commands

Interactive sessions refer to a user typing commands at the SparForte command prompt.  AdaScript has a number of built-in commands to be used at a command prompt. The commands behave as if they were external commands.

cd -|dirname

change directory. "-" is the previous directory.  A leading '~' is your home directory.

Bash equivalent: cd
Perl equivalent: chdir
PHP equivalent: chdir
 

clear

Reset the display device and clear the screen, placing the cursor in the top-left corner of the display.

Bash equivalent: tput reset; stty sane; tput clear
Perl equivalent: N/A
PHP equivalent: N/A
 

env [ident]

Display a list of all declared identifiers, their values and their properties, or the properties of a particular identifier.

Examples:

=> i : integer := 3
=> env i
i := 3; -- identifier of the type integer
=> c : constant string := "company"
=> env c
c := "company"; -- constant string
=> env HOME
HOME := "/home/ken"; -- imported shell environment identifier of the type string
=> env TERM
TERM := "xterm"; -- imported exported shell environment identifier of the type string
=> => env true
true := true; -- constant boolean enumerated item
=> env strings.length
; -- built-in function
=> env if
( AdaScript reserved word )
=> env ASCII.CR
ASCII.CR := '[# 13]'; -- constant character
=> env | tail -5

PWD                  | /home/ken/ada/bush/example | imported identifier of the type string
| s |
HOME | /home/ken | imported identifier of the type string
OLDPWD | /home/ken | identifier of the type universal_string
tail | | identifier of the type new

Bash equivalent: env
Perl equivalent: Data::Dumper
PHP equivalent: var_dump
 

help [-c|-h|-m|-l|-t] [command or script]

Display a summary of SparForte commands or show annotations (see pragma annotate) in a script. When showing annotations, -h will show the annotations in HTML, -m as a Linux man page and, with no options, SparForte will show the annotations as plain text. With -l, SparForte will show the script license as set with pragma license. With -c, the teamwork pragmas will be shown in CSV format. With -t, the todo pragmas will be shown in CSV format and with a work summary.

Examples:

=> help reset
reset - reopen a file
  reset( file [,mode])
=> help -l bjack.sp
public_domain
=> help bjack.sp
Help for script bjack.sp:

Basic Blackjack

  A basic version of the Blackjack or 21 card game

Usage: bjack
Bash equivalent: help
Perl equivalent: perldoc
PHP equivalent: phpdoc

Implementation Note: help -c and -t are experimental and the output may change to improve their effectiveness.

 

history [n]

show the command history (up to n lines). If the number of lines is not specified, show all the command history

Bash equivalent: pwd
Perl equivalent: getcwd
PHP equivalent: cwd
 

jobs

list status of current background processes

Bash equivalent: jobs
Perl equivalent: N/A
PHP equivalent: N/A
 

logout

Stop an interactive, login session and leave the SparForte shell. SparForte uses a login session if SparForte is your login shell or if you start SparForte with the --login option. When in the debugger (breakout mode), stop debugging and leave the SparForte shell. If the session is not a login session, an error is displayed. Normally, return will exit SparForte. login is required for login sessions to prevent the user from mistakenly logging themselves out if quitting multiple shells, to let the user know they are in their top-most shell.

Examples:

=> return
return;
^----^ warning: This is a login shell.  Use logout to quit.

=> logout
Bash equivalent: logout
Perl equivalent: N/A
PHP equivalent: N/A
 

pwd

show the present (current) working directory

Bash equivalent: pwd
Perl equivalent: getcwd
PHP equivalent: cwd
 

trace [ boolean ]

When trace is true, the lines being executed are displayed, along with additional information in parentheses, showing how SparForte interprets the commands. The line number is displayed in square brackets after the line. The first line is not shown which means trace, at the command prompt, always displays "End of File" for line 2 because there is only one line to run. trace by itself shows the current status (true or false).

Examples:

=> trace
Trace is currently off
=> trace true
Trace is on
=> "End of File" [ 2]
=> ls | wc -l
=> (shell word 'ls' expands to:)
=> (ls)
=> (exporting 'TERM=xterm')
=> (/bin/ls output attached to input end of pipe fd 7)
=> (shell word 'wc' expands to:)
=> (wc)
=> (shell word '-l' expands to:)
=> (-l)
=> (exporting 'TERM=xterm')
=> (/usr/bin/wc input attached to output end of pipe fd 6)
68
=> "End of File" [ 2]

Bash equivalent: set -x
Perl equivalent: Debug::Trace
PHP equivalent: xdebug
 

typeset var is type

Change the type of a variable, declaring it if necssary. It will attempt to typecast the value of the variable if the variable exists: this may raise an exception if the variable cannot be typecast. Typeset can only be used in an interactive session (the command prompt). It cannot be used with pragma ada_95.

Examples:

=> y := 5.5
=> (Assuming y is a new universal_numeric variable)
=> env y
y := 5.50000000000000E+00; -- identifier of the type universal_numeric
=> typeset y is float
=> env y
y := 5.50000000000000E+00; -- identifier of the type float
=> typeset y is integer
=> env y
y := 6; -- identifier of the type integer
 

Bash equivalent: typeset or declare
Perl equivalent: N/A
PHP equivalent: N/A
 

unset ident

Permanently delete an identifier. Keywords cannot be unset. Unset can only be used in an interactive session (the command prompt). It cannot be used with pragma ada_95.

Examples:

=> i : integer
=> unset i

=> ? i
? i;
  ^ i not declared
Bash equivalent: unset
Perl equivalent: N/A
Python equivalent: del
PHP equivalent: unset
 

wait

wait for all background processes to finish running

Bash equivalent: wait
Perl equivalent: N/A
PHP equivalent: N/A
 
[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]