home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-04 | 158.2 KB | 10,033 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Reference Manual
-
- SKsh
-
- A ksh-like Shell for the Amiga
-
- Version 1.7
-
-
- (Copyright) 1988-1991
-
- Steve Koren
-
- May 4, 1991
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Table of Contents
-
-
- Introduction......................................5
- !, !!.............................................6
- _ANSI.............................................7
- _DIR_.............................................8
- _FILE_............................................8
- _EXEC_............................................8
- alias.............................................10
- aliases...........................................11
- AREXX_PORT........................................12
- argcount..........................................13
- SKSHINIT..........................................14
- sksh..............................................15
- basename..........................................17
- break.............................................18
- BPWD..............................................19
- builtins..........................................20
- capital...........................................21
- car...............................................22
- case/esac.........................................23
- cat...............................................24
- cd................................................25
- CDPATH............................................26
- cdr...............................................27
- chext.............................................28
- chmod.............................................29
- cilist............................................30
- clear, cls........................................32
- cleard............................................33
- CLINUM............................................34
- CMDNUM............................................35
- COLUMNS...........................................36
- complist..........................................37
- continue..........................................39
- ctpri.............................................40
- date..............................................41
- dec...............................................42
- dir...............................................43
- dirname...........................................44
- DIRSTACK..........................................45
- dstack............................................46
- dwclist...........................................47
- echo..............................................49
- emacs_mode........................................50
- eval..............................................51
- exit..............................................52
- export............................................53
- false.............................................56
- for/do/done.......................................57
- force.............................................58
- function..........................................59
- functions.........................................60
-
-
- SKsh Amiga Shell Page 2 Reference Manual
-
-
-
-
-
-
-
-
-
- getenv............................................61
- histhist..........................................62
- histload..........................................63
- history...........................................64
- histrm............................................66
- histsave..........................................67
- HISTSIZE..........................................68
- HOME..............................................69
- IFS...............................................71
- inc...............................................72
- info..............................................73
- INTERACTIVE.......................................74
- line..............................................77
- LINES.............................................78
- ll................................................79
- LLMIN.............................................80
- local.............................................81
- LOGOUT............................................82
- ls................................................83
- man...............................................85
- MANPATH...........................................86
- match.............................................87
- MAXDIST...........................................88
- mem...............................................89
- mkdir.............................................90
- mplist............................................91
- mv................................................93
- numloop/do/done...................................94
- OLDPWD............................................95
- options...........................................96
- OS_VER............................................100
- PAGER.............................................101
- PATH..............................................102
- path..............................................103
- pathconv..........................................104
- PNPC..............................................105
- PNPC2.............................................106
- popd..............................................107
- preparse..........................................108
- printf............................................109
- ps................................................110
- PS1...............................................111
- PS2...............................................112
- pushd.............................................113
- PWD...............................................114
- pwd...............................................115
- qrm...............................................116
- quit..............................................117
- read..............................................118
- RECUR_DEPTH.......................................119
- resident..........................................120
- return............................................121
- rm................................................122
- rmdir.............................................123
-
-
- SKsh Amiga Shell Page 3 Reference Manual
-
-
-
-
-
-
-
-
-
- ROOT..............................................124
- set...............................................125
- setmap............................................126
- SHARED_TYPE.......................................129
- SHELL.............................................130
- shift.............................................131
- SIZE..............................................132
- sleep.............................................133
- source............................................134
- stack.............................................135
- SYSNAME...........................................136
- tackon............................................137
- time..............................................138
- tolower...........................................139
- touch.............................................140
- toupper...........................................141
- true..............................................142
- unalias...........................................143
- unfunc............................................144
- unset.............................................145
- usage.............................................146
- variables.........................................147
- version...........................................148
- vi_mode...........................................149
- whence............................................150
- which.............................................151
- while/do/done.....................................152
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 4 Reference Manual
-
-
-
-
-
-
-
-
-
- Introduction
-
- This reference manual describes each SKsh command, variable,
- alias, or function in a concise manner. Each page contains
- the following information:
-
- Name: The name of the command, alias, etc.
-
- Type: Variable, Alias, Function, Builtin, Script, or
- Keyword.
-
- Default: The default value for variables, or definition for
- aliases.
-
- Usage: Command syntax
-
- Range: Legal values for variables or parameters
-
- About: Text describing the command, variable, etc.
-
- Example: A brief example usage.
-
- See Also: Other related commands, variables, etc.
-
- When reading the command syntax, anything in square brackets
- is optional. Anything followed by three dots can be re-
- peated any number of times. A vertical bar is used to sepa-
- rate option where one or the other, but not both, can be
- used.
-
- In general, options to commands are preceded by a dash ('-
- '). The dash character passed alone tells a command to stop
- reading options. This can be useful to pass a dash as a
- parameter. For example,
-
- echo - -
-
- would print a single dash. Also, 'command -a -b' is equiva-
- lent to 'command -ab'.
-
- In version 1.4 and later of SKsh, the documentation for ex-
- ternal binary commands has been moved to the ExtCmds.doc
- file.
-
- In version 1.7 and later, commands will print usage messages
- if passed '-?' as a single parameter.
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 5 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: !, !!
-
- Type: Alias
-
- Default: history -e
- history -e -1
-
- Usage: ! [ pattern | abs_num | rel_num ]
- !!
-
- Range: n/a
-
- About: These two aliases provide an easy way to use the
- history -e command. !! will execute the previous
- command from the history list by executing history
- -e -1. ! will execute a specified command from
- the history list. This command can either specify
- an absolute number, a relative offset from the
- most recent command (the offset should be nega-
- tive), or a partial line or pattern to search for.
- If a search pattern is given, it should be en-
- closed in quotes so that SKsh does not attempt
- file name generation on the wildcard pattern.
-
- Example: ! cc
-
- See Also: history
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 6 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: _ANSI_BS
- _ANSI_BE
- _ANSI_IS
- _ANSI_IE
- _ANSI_US
- _ANSI_UE
- _ANSI_P1
- _ANSI_P2
- _ANSI_P3
- _ANSI_CLEAR
-
- Type: Variable
-
- Default: "^[[1m" (bold-start)
- "^[[m" (bold-end)
- "^[[3m" (italic-start)
- "^[[m" (italic-end)
- "^[[4m" (underline-start)
- "^[[m" (underline-end)
- "^[[0;31;40m" (pen-1)
- "^[[0;32;40m" (pen-2)
- "^[[0;33;40m" (pen-3)
- "^[[H^[[2J" (clear screen)
-
- Usage: $_ANSI_??
-
- Range: n/a
-
- About: These variables are set by SKsh to valid ANSI es-
- cape sequences which control the Amiga console
- device. They can be used in echo statements or
- prompts.
-
- Since these variables, when output, affect the
- console device, they are not normally displayed by
- the set command.
-
- Example: echo $_ANSI_CLEAR # clear the screen
-
- See Also: echo
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 7 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: _DIR_S
- _DIR_E
- _DIR_L
- _FILE_S
- _FILE_E
- _DIR_L
- _EXEC_S
- _EXEC_E
- _EXEC_L
-
- Type: Variable
-
- Default: "$_ANSI_P3" (dir-start)
- "$_ANSI_P1" (dir-end)
- 0 (dir-length)
- NULL (file-start)
- NULL (file-end)
- 0 (file-length)
- NULL (exec-start)
- NULL (exec-end)
- 0 (exec-length)
-
- Usage:
-
- Range: n/a
-
- About: These variables control the display format of the
- 'ls' command when the '-F' option is set (as it is
- by default when the 'dir' or 'll' commands are
- used). Before printing each file name (whether in
- a short or long format listing), SKsh will examine
- the file type. If the it is a directory, the con-
- tents of the _DIR_S variable is printed. If it is
- a file, the contents of _FILE_S is printed. If
- the 'e' bit is set, _EXEC_S is printed. (Because
- of this, it is possible to print more than one of
- the above variables if the name is both a file and
- has its 'e' bit set).
-
- In a similar manner, the contents of the appropri-
- ate _FILE_E, _DIR_E, and _EXEC_E variables is
- printed after the file name. This allows the for-
- mat of the directory listing to be customized.
-
- These variables are only output when the '-F' op-
- tion is used. Also, their contents is printed
- verbatim; it is not expanded as with 'PS1'. Thus,
- any variables should be expanded when these vari-
- ables are set, as in the example below.
-
- The _DIR_L, _EXEC_L, and _FILE_L variables store
- integers which should represent the printing
-
-
- SKsh Amiga Shell Page 8 Reference Manual
-
-
-
-
-
-
-
-
-
- length of the _DIR_S, _DIR_E, etc variables. This
- lets the ls command correctly judge the width of
- the display. The _L variables should store the
- combined printing length of both the _S and _E
- variables. For example, if _DIR_S has a printing
- length of 1 and _DIR_E has a printing length of 2,
- _DIR_L would be set to 3.
-
- Example: _FILE_S="$_ANSI_US" # underline file names
- _FILE_E="$_ANSI_UE"
-
- _DIR_S='' # print highlighed / after dirs
- _DIR_E="$_ANSI_P3/$_ANSI_P1"
- _DIR_L=1
-
- See Also: ls, dir, ll
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 9 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: alias
-
- Type: Builtin
-
- Default: n/a
-
- Usage: alias [ -t ] [ pattern | string [ '=' ] string ]
-
- Range: n/a
-
- About: The alias builtin command (not to be confused with
- 'aliases', which is itself an alias) is used to
- set and list aliases. If given no parameters, it
- simply acts as a 'set -a' command. If given one
- parameter, which is a pattern, all aliases match-
- ing that pattern are printed. If given two param-
- eters (or there where the second is a '='), the
- first string becomes an alias with the second
- string as its definition.
-
- Aliases are expanded when used as a command. Any
- arguments are appended to the text of the aliases
- and the resulting string is executed.
-
- Unlike ksh and sh, there can be spaces surrounding
- the '=' sign, which is itself optional.
-
- The -t option causes the alias command to use the
- top level symbol table to find aliases. This is
- useful with the shared SKsh modes.
-
- Example: alias foo='echo "This is the foo alias"'
-
- See Also: set, alias, unalias
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 10 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: aliases
-
- Type: Alias
-
- Default: set -a
-
- Usage: aliases [-s] [pattern]
-
- Range: n/a
-
- About: This alias lists defined aliases. The pattern
- uses normal wildcards, but must be quoted to avoid
- being interpreted by the filename expansion
- mechanism. If the pattern is omitted, all aliases
- in the current context are listed except those be-
- ginning with an underscore (hidden aliases).
-
- Only aliases for the current context are listed,
- so this command may have a different effect inside
- of a subshell or function than when typed
- manually.
-
- Example: aliases -s '[a-h]*'
-
- See Also: set, alias
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 11 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: AREXX_PORT
-
- Type: Variable
-
- Default: SKSH or SKSH_$CLINUM
- unset if no ARexx port available
-
- Usage: $AREXX_PORT
-
- Range: n/a
-
- About: This variable contains the name of the ARexx port
- opened by SKsh open invocation. The variable will
- be unset if SKsh did not open an ARexx port
- (either because it was told not to, or it could
- not because ARexx was not installed).
-
- Example: if [ -z "$AREXX_PORT" ]
- then
- echo "This SKsh does not have an ARexx port"
- else
- echo "The ARexx port name is $AREXX_PORT"
- fi
-
- See Also: sksh
- UserMan.doc:
- Advanced Topics: Using SKsh with ARexx
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 12 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: argcount
-
- Type: Builtin
-
- Default: n/a
-
- Usage: argcount [ parameter ... ]
-
- Range: n/a
-
- About: argcount simply prints a count of its arguments.
-
- Example: argcount should 'print two'
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 13 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: SKSHINIT
-
- Type: Variable
-
- Default: "sksh:.skshrc"
-
- Usage: $SKSHINIT
-
- Range: n/a
-
- About: This variable is set in the .skshinit file to the
- name of a user modifiable configuration file.
- Normally this is "s:.skshrc". The user configura-
- tion file is sourced (not executed!) for interac-
- tive SKsh sessions.
-
- The s:.skshrc file is provided for user
- modification. Users should not modify
- s:.skshinit. If you wish to change something that
- is defined in s:.skshinit, simply redefine it in
- s:.skshrc. s:.skshrc is sourced after
- s:.skshinit.
-
- Your s:.skshrc file may optionally source other
- files.
-
- In SKsh 1.5 and later, the preparsed form of this
- file will be executed if it exists instead of the
- ascii form.
-
- Example:
-
- See Also: sksh, source, preparse
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 14 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: sksh
-
- Type: External Command
-
- Default: n/a
-
- Usage: sksh [ -n ] [ -a | -p portname ]
- [ -c string | fspec... ]
-
- Range: n/a
-
- About: This is, of course, the main SKsh binary. If in-
- voked with no parameters, an interactive SKsh ses-
- sion is started. If invoked with the '-c' option
- followed by a string, the string is executed by
- SKsh as if it had been typed, and SKsh exits when
- the operation is complete. If the string contains
- spaces, it must be surrounded by quotes (although
- this depends on the invoking shell or environ-
- ment). If invoked with filespec arguments, each
- file in turn is executed (not sourced). SKsh then
- exits when finished executing all the files.
-
- If SKsh is invoked non-interactively, it will
- still read the .skshinit file, but not the .skshrc
- file. This allows you to have output statements
- in the .skshrc file without having this output ap-
- pear when non-interacrive scripts are run. If you
- really want to run the .skshrc file first, use:
-
- sksh s:.skshrc my_file.sksh
-
- If SKsh is given the "-a" flag upon invocation, it
- attempts to open an ARexx port if ARexx is indeed
- installed on the system. The default port name is
- "SKSH" (all caps). If this port is taken (perhaps
- by another invocation of SKsh), SKsh appends an
- underscore and the cli number of this process (for
- example, "SKSH_5"), and tries again. If it still
- cannot open the port, it gives up.
-
- If the "-p" flag is given followed by a port name,
- SKsh will attempts to use the following argument
- as a portname when opening ARexx.
-
- If the "-n" flag is given, SKsh will read neither
- the .skshrc file nor the .skshinit file. This is
- not generally useful for interactive sessions, but
- may be useful to execute a simple non-interactive
- script which does not need .skshrc or .skshinit
- initialization.
-
-
-
- SKsh Amiga Shell Page 15 Reference Manual
-
-
-
-
-
-
-
-
-
- Example: sksh -c "expr 21 * 2"
-
- See Also: source, AREXX_PORT
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 16 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: basename
-
- Type: Builtin
-
- Default: n/a
-
- Usage: basename [ fspec ... ]
-
- Range: n/a
-
- About: basename prints the "base" name of a given path.
- For example, the basename of sys:System/Format is
- simply Format. Note that the basename may be a
- directory and not a file; for example, the
- basename of sys:usr/bin is bin, even though bin is
- a directory. If basename is passed more than one
- parameter, it prints the basename of each param-
- eter in turn.
-
- Example: basename sys:usr/bin/wc
-
- See Also: dirname, extname
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 17 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: break
-
- Type: Builtin
-
- Default: n/a
-
- Usage: break [ num ]
-
- Range: n/a
-
- About: break exits gracefully from an enclosing for or
- while loop. If a numeric argument is given, it
- breaks from that many enclosing levels of for or
- while.
-
- Example: for a in a b c d e f
- do
- echo $a
- if [ "$a" = "c" ] then break; fi
- done
-
- See Also: continue
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 18 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: BPWD
-
- Type: Variable
-
- Default: base name of present working directory
-
- Usage: $BPWD
-
- Range: n/a
-
- About: This variable is similar to $PWD, but holds only
- the basename of the present working directory.
- This is sometimes useful to imbed in prompts.
-
- Example: echo "basename of PWD = $BPWD"
-
- See Also: OLDPWD, PWD, pwd, cd
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 19 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: builtins
-
- Type: Alias
-
- Default: set -b
-
- Usage: builtins [ -s ] [ pattern ]
-
- Range: n/a
-
- About: This aliases lists SKsh builtin commands. The
- pattern uses normal wildcards, but must be quoted
- to avoid being interpreted by the filename expan-
- sion mechanism. If the pattern is omitted, all
- builtins are listed except those beginning with an
- underscore character (hidden builtins). There are
- currently no hidden builtins.
-
- Example: builtins -s '[a-h]*'
-
- See Also: set
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 20 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: capital
-
- Type: Builtin
-
- Default: n/a
-
- Usage: capital [ -nc ] [ parameter ... ]
-
- Range: n/a
-
- About: This command echos its arguments, converting the
- first character of each argument to upper case if it
- is a lower case character. The -n option will not
- append a newline, and the -c option will concatenate
- arguments, similar to echo.
-
- Example: capital 'Arguments' 'are' 'all' 'Capitalized'
-
- See Also: toupper, tolower, echo
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 21 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: car
-
- Type: Builtin
-
- Default: n/a
-
- Usage: car string [ sep_char ]
-
- Range: n/a
-
- About: car provides a lisp-like car function which can be
- used to extract items from lists stored in
- strings. car examines the string, and extracts
- the first item separated by sep_char, which is by
- default a space. If given a second argument, that
- is used in as sep_char in place of a space.
-
- Example: mystring='item1,item2,item3,item4,item5,item6'
- firstitem=$(car "$mystring" ',')
-
- See Also: cdr
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 22 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: case/esac
-
- Type: Keywords
-
- Default: n/a
-
- Usage: case param in { pattern ) stmt_list ;; } ... esac
-
- Range: n/a
-
- About: If the supplied parameter matches any of the
- (wildcard) patterns, then the statement list for
- that pattern is executed. A close-paren ( ")" )
- must follow the wildcard pattern, and a double
- semicolon must terminate the statement list. The
- case statement must be terminated by a matching
- esac keyword.
-
- Example: case "$foo" in
- bar) echo "Matched bar";
- echo "testing..." ;;
- n*t) echo "Matched n*t";;
- a??c) echo "Matched a??c";;
- esac
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 23 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: cat
-
- Type: Builtin
-
- Default: n/a
-
- Usage: cat [ fspec ... ]
-
- Range: n/a
-
- About: cat prints the contents of each file passed to it
- on the command line, or the standard input if no
- files are passed. The contents of each file are
- concatenated, and are not separated by blank
- lines.
-
- In SKsh 1.5 and later, there are two forms of the
- cat command, a builtin and an external binary.
- The external binary is described in the
- ExtCmds.doc file. It can be made the default; see
- the documentation there for details.
-
- In SKsh, the builtin cat cannot be used to trans-
- fer binary files, only ASCII data. Also, the se-
- quence:
-
- cat my_file.txt > my_file1.txt
-
- can be faster accomplished with the cp command or
- the external cat command.
-
- Example: cat my_file.txt
-
- See Also: cp
- The cat entry in the ExtCmds.doc file
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 24 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: cd
-
- Type: Builtin
-
- Default: n/a
-
- Usage: cd [ -p | dirname ]
-
- Range: n/a
-
- About: cd changes the current working directory to
- dirname, or to the previous directory (the con-
- tents of the OLDPWD variable) if the -p flag is
- set. If no parameters are passed, cd moves to the
- directory indicated by the HOME variable. This is
- convenient when you are doing most of your work in
- one place, and wish to return there easily. Under
- AmigaDos, the HOME variable can be changed very
- easily with:
-
- HOME=.
-
- That is, you do not have to worry about certain
- files being in the HOME directory as you do in a
- multi-user operating system such as UNIX.
-
- Example: cd -p # go back to old directory
-
- See Also: PWD, pwd, OLDDIR
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 25 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: CDPATH
-
- Type: Variable
-
- Default: Unset
-
- Usage: $CDPATH
-
- Range: n/a
-
- About: If CDPATH is set to a list of comma separated list
- of directory names, the cd command will search
- those directories after $PWD if passed a non-
- qualified directory name (one not containing
- slashes or colons). The CDPATH variable should
- not be set directly, but rather, be set through
- the -cd option to the path command.
-
- Example: path -cd -add sys:usr
- cd ram:
- cd src # cd's to sys:usr/src if it exists and
- # there is no "src" directory in ram:
-
- See Also: cd, path
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 26 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: cdr
-
- Type: Builtin
-
- Default: n/a
-
- Usage: cdr string [ sep_char ]
-
- Range: n/a
-
- About: cdr provides a lisp-like cdr function which can be
- used to extract items from lists stored in
- strings. cdr examines the string, and extracts
- the remainder of the list after removing the first
- item separated by sep_char, which is by default a
- space. If given a second argument, that is used
- in as sep_char in place of a space.
-
- Example: mystring='item1,item2,item3,item4,item5,item6'
- rest_of_string=$(cdr "$mystring" ',')
-
- See Also: cdr
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 27 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: chext
-
- Type: Script
-
- Default: n/a
-
- Usage: chext newext files..
-
- Range: n/a
-
- About: chext changes the extensions on files by removing
- any old extension present and appending the new
- one. The new extension may either be prefixed by
- a dot or not. In either case, chext will separate
- the old name and the new extension by only one
- dot.
-
- Example: touch a.foo bb.foo ccc.foo d.foo
- chext .bar *.foo
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 28 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: chmod
-
- Type: Builtin
-
- Default: n/a
-
- Usage: chmod flags | +flags | -flags [ file ... ]
-
- Range: flags : "hsparewd"
-
- About: chmod changes the file protection bits on the
- named files. Flags can be one or more of the fol-
- lowing letters: "hsparewd". If the flags param-
- eter is given directly with no leading '+' or '-',
- the permissions for all the named files are set to
- that value. A leading '+' causes the indicated
- permissions bits to be set without changing the
- others, and a leading '-' causes them to be reset.
- In addition, a 'x' may be used in place of the 'e'
- flag.
-
- Example: chmod -a *.c # reset archive bit on all .c files
-
- See Also: ls
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 29 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: cilist
-
- Type: Builtin
-
- Default: -l option
-
- Usage: cilist [ -adrel ] [ patterns ... ]
-
- Range: n/a
-
- About: The cilist (completion-ignore list) command pro-
- vides a method to enhance the command line
- filename completion mechanism. It only functions
- if SKsh command line editing is enabled. The
- cilist is used to store patterns which should be
- ignored during file completion. For example, if
- it contained the patterns "*.info", "*.bak", and
- "ZZ*", file completion would effectively ignore
- files matching any of those patterns. This can be
- useful if there are certain types of files which
- you wish to ignore during completion.
-
- -a Add the supplied arguments to the cilist.
- The old contents of the list are left in
- place.
-
- -d Delete the supplied arguments from the
- cilist.
-
- -r Synonym for -d.
-
- -e Empty the cilist.
-
- -l List the contents of the cilist, one name per
- line. If no command line switches are given,
- this is the default.
-
- Hints: Please note the following:
-
- * The patterns added to the cilist must be es-
- caped or quoted to avoid being interpreted as
- wildcards by the shell. Alternatively, the
- cilist command itself can be added to the dw-
- clist (see that command for details).
-
- * The cilist will remove all entries matching
- any of the given patterns. This includes en-
- tries from the complist.
-
- * The cilist can be null if you don't wish to
- use this feature.
-
-
-
- SKsh Amiga Shell Page 30 Reference Manual
-
-
-
-
-
-
-
-
-
-
- Example: cilist -e # empty the cilist
- # now add these names...
- cilist -a '*.info' '*.bak' '*~' '*.o'
-
- See Also: complist
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 31 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: clear, cls
-
- Type: Alias
-
- Default: echo -n $_ANSI_CLEAR
-
- Usage: clear
-
- Range: n/a
-
- About: These aliases both clear the screen by echoing
- $_ANSI_CLEAR.
-
- Example: clear
-
- See Also: _ANSI_CLEAR
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 32 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: cleard
-
- Type: Script
-
- Default: n/a
-
- Usage: cleard
-
- Range: n/a
-
- About: The cleard script clears the directory stack. The
- DIRSTACK variable should never be changed manu-
- ally, but rather, always through these directory
- stack functions.
-
- Example: pushd sys:utilities # push directory
- cleard # clear dir stack
-
- See Also: pushd, popd, dstack, DIRSTACK
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 33 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: CLINUM
-
- Type: Variable
-
- Default: n/a
-
- Usage: $CLINUM
-
- Range: 1 to maximum process number limit
-
- About: This variable is set to the CLI process number of
- SKsh when it is started.
-
- Example: echo "Process # = $CLINUM"
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 34 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: CMDNUM
-
- Type: Variable
-
- Default: n/a
-
- Usage: $CMDNUM
-
- Range: 1 to 16 million
-
- About: Each time SKsh inputs a line from the keyboard,
- this variable is incremented.
-
- Example: echo "$CMDNUM lines have been entered so far."
-
- See Also: history
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 35 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: COLUMNS
-
- Type: Variable
-
- Default: 72
-
- Usage: $COLUMNS
-
- Range: 15 to 130
-
- About: This variable is one of several responsible for
- controlling the actions of SKsh line editing and
- display output. If line editing is enabled, and
- the cursor moves beyond the column indicated by
- this variable, SKsh slides the line to the left by
- 12 characters. SKsh also uses this variable to
- truncate the output of certain internal SKsh com-
- mands (such as History). This creates a cleaner
- display.
-
- This variable is normally set automatically by
- SKsh when the window is resized, although this be-
- havior can be disabled with the options command.
-
- Example: COLUMNS=78
-
- See Also: PNPC, LINES, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 36 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: complist
-
- Type: Builtin
-
- Default: -l option
-
- Usage: complist [ -adrel ] [ names ... ]
-
- Range: n/a
-
- About: The complist command provides a method to extend
- the command line filename completion mechanism.
- It only functions if SKsh command line editing is
- enabled. SKsh maintains an internal completion
- list of user defined strings. When <tab> or
- <esc><esc> are used to complete a string, the in-
- ternal completion list is consulted before comple-
- tion is attempted on files. If a match is found
- in the internal completion list (even if it is but
- a partial match), it is used. If not, then
- filename completion proceeds as normal. An option
- is provided to turn on or off this behaviour (see
- the options command for details).
-
- -a Add the supplied arguments to the completion
- list. The old contents of the list are left
- in place.
-
- -d Delete the supplied arguments from the
- completion list.
-
- -r Synonym for -d.
-
- -e Empty the completion list.
-
- -l List the contents of the completion list, one
- name per line. If no command line switches
- are given, this is the default.
-
- Hints: The completion list can, among other things, be
- used to:
-
- * Maintain a user defined list of strings to
- contain, for example, device or program names
- (such as "graphics:" or "calculator") which
- are commonly typed.
-
- * Contain programs names which are found in the
- search path.
-
- * Buffer the contents of the current directory
- so that subsequent successful completions do
-
-
- SKsh Amiga Shell Page 37 Reference Manual
-
-
-
-
-
-
-
-
-
- not have to read the directory. This makes
- filename completion usable on a floppy based
- system or on a hard disk when a directory
- contains a large number of files. A shell
- function is supplied in the Stuff.sksh file
- which adds the files in the current directory
- to the completion list.
-
- * Perform completion on files stored inside of
- a zoo archive. A function supplied in the
- Stuff.sksh file facilitates this process. It
- could also, with a little work, be extended
- to handle other archive types.
-
- Example: complist -e # empty the completion list
- # now add these names...
- complist -a graphics: my_program foo
-
- See Also: zget, cget (from Stuff.sksh)
- options (+C)
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 38 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: continue
-
- Type: Builtin
-
- Default: n/a
-
- Usage: continue [ num ]
-
- Range: n/a
-
- About: continue resumes execution with the next iteration
- of the surrounding loop, or the nth subsequent it-
- eration if given a numeric argument.
-
- Example: for a in a b c d e f
- do
- echo $a
- if [ "$a" = "c" ] then continue; fi
- echo "This is not echoed when \$a = c"
- done
-
- See Also: break
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 39 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: ctpri
-
- Type: Alias
-
- Default: ChangeTaskPri
-
- Usage: ctpri
- ctpri num
-
- Range: -31 <= num <= 31
-
- About: This alias is provided as a shorter alternative to
- the AmigaDos ChangeTaskpri command. Its use is
- identical.
-
- Example: ctpri 1
-
- See Also: stack
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 40 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: date
-
- Type: Builtin
-
- Default: n/a
-
- Usage: date [-aDmdty]
-
- Range: n/a
-
- About: Date prints the current date as a 24 character
- string:
-
- DDD mmm dd hh:mm:ss yyyy
-
- Date with the -a (all) option is identical to date
- with no parameters, (which prints the date as above).
- Date -D prints a three character representation of
- the day of the week. Date -m prints a three charac-
- ter representation of the month. Date -d prints the
- day number as two digits. Date -t prints the time
- string, and date -y prints the year as four digits.
-
- Example: date -y # find the year
-
- See Also: time
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 41 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: dec
-
- Type: Builtin
-
- Default: n/a
-
- Usage: dec var [ count ]
-
- Range: n/a
-
- About: dec decrements the contents of the variable by
- count, or 1 if count is not given. It is equiva-
- lent to, but faster than, 'var=$(expr $var -
- $count)'
-
- Example: dec my_var 3
-
- See Also: inc
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 42 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: dir
-
- Type: Alias
-
- Default: ls -bF
-
- Usage: dir [ file | dir ] ...
-
- Range: n/a
-
- About: dir prints a short format directory listing, with
- only the basename of each file printed. Note that
- the 'F' option to 'ls' is set.
-
- Example: dir s:
-
- See Also: ls, ll
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 43 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: dirname
-
- Type: Builtin
-
- Default: n/a
-
- Usage: dirname [ files ... ]
-
- Range: n/a
-
- About: dirname prints the "directory" name of a given
- path. For example, the dirname of sys:System/For-
- mat is simply sys:System. If dirname is passed
- more than one parameter, it prints the dirname of
- each parameter in turn.
-
- Example: dirname sys:usr/bin/wc
-
- See Also: basename, extname
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 44 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: DIRSTACK
-
- Type: Variable
-
- Default: Unset
-
- Usage: $DIRSTACK
-
- Range: n/a
-
- About: This variable is used to store the directory stack
- as used by the pushd and popd scripts. It should
- not be set manually, but rather be modified
- through the directory stack scripts. The dstack
- function can be used to examine the contents of
- the variable, and cleard will clear it.
-
- Example:
-
- See Also: pushd, popd, cleard, dstack
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 45 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: dstack
-
- Type: Script
-
- Default: n/a
-
- Usage: dstack
-
- Range: n/a
-
- About: The dstack script lists the directory stack, one
- directory per line. The directories listed on the
- top of the stack will be popped first when the
- popd script is used.
-
- Example: pushd sys:utilities # push directory
- dstack # list dir stack
-
- See Also: pushd, popd, cleard, DIRSTACK
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 46 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: dwclist
-
- Type: Builtin
-
- Default: -l option
-
- Usage: dwclist [ -adrel ] [ names ... ]
-
- Range: n/a
-
- About: The dwclist (disabled wildcard list) command pro-
- vides the ability so selectively disable wildcard
- expansion for individual commands. When expanding
- wildcards, SKsh first checks the command name for
- inclusion in the dwclist. If found, SKsh will not
- expand parameters which contain wildcards, but
- rather, will pass these wildcards to the command
- directly.
-
- The dwclist is very useful for external programs
- which perform their own wildcard expansion. By
- putting the command in the dwclist, SKsh will let
- that command perform its own wildcard expansion,
- thus circumventing the 255 character command line
- limit in AmigaDos 1.3.
-
- An option is provided to turn on or off this be-
- haviour (see the options command for details).
- The default is to ignore the dwclist.
-
- The following arguments, similar to those for the
- complist command, are accepted:
-
- -a Add the supplied arguments to the dwclist.
- The old contents of the list are left in
- place.
-
- -d Delete the supplied arguments from the
- dwclist.
-
- -r Same as -d.
-
- -e Empty the dwclist.
-
- -l List the contents of the dwclist list, one
- name per line. If no command line switches
- are given, this is the default.
-
- Hints: The following should be noted:
-
- * The +w option is not set by default. It must
- be set explicitly to use the dwclist feature.
-
-
- SKsh Amiga Shell Page 47 Reference Manual
-
-
-
-
-
-
-
-
-
-
- * Use of long a long dwclist will slightly de-
- grade the SKsh interpreter performance, al-
- though commands in the list will run much
- faster if passed parameters with wildcards.
-
- * SKsh searches for the first argument verbatim
- in the dwclist. This means that, for ex-
- ample, if a program is added to the list as
- "myprog", it must be invoked in the same
- manner. Supplying a path name will not work,
- unless the entire path is also added to the
- list.
-
- * SKsh does not care whether entries in the
- list are external programs or internal built-
- ins, functions, or aliases.
-
- * If an alias or a function is used to invoke
- an external command, both the alias or func-
- tion name and the external command name must
- appear in the dwclist. Otherwise, SKsh will
- attempt to expand the wildcards for the one
- not listed.
-
- Example: dwclist -e # empty the dwclist
- # now add these names...
- dwclist -a zoo lharc
-
- See Also: options (+w)
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 48 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: echo
-
- Type: Builtin
-
- Default: n/a
-
- Usage: echo [-nc] [ parameter ... ]
-
- Range: n/a
-
- About: The echo command simply prints its arguments to stan-
- dard output. If given no arguments, it prints a
- newline. Otherwise, it prints its arguments, sepa-
- rated by a single space, unless the -c option is set,
- in which case no separating spaces are printed (con-
- catenation mode). Echo normally prints a trailing
- newline, unless the -n option is set, in which case
- no trailing newline is printed.
-
- 'echo -c' is useful for concatenating strings:
-
- result = $(echo -c This '+' That)
-
- Example: echo 'These' 'arguments' are "echoed"
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 49 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: emacs_mode
-
- Type: Script
-
- Default: n/a
-
- Usage: emacs_mode
-
- Range: n/a
-
- About: emacs_mode executes a series of setmap commands to
- implement an emacs-like command line editing mode.
- This editing mode is described in detail in the
- UserMan.doc file. This does not operate with
- Tiny_SKsh.
-
- Example: emacs_mode # set emacs command line editing.
-
- See Also: vi_mode, setmap
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 50 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: eval
-
- Type: Builtin
-
- Default: n/a
-
- Usage: eval [ string ... ]
-
- Range: n/a
-
- About: eval executes the text of the supplied strings as
- if they were SKsh commands. If more than one
- string is given, they are evaluated in order.
-
- Example: foo='for a in a b c; do; echo $a; done'
- eval "$foo" 'echo boo'
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 51 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: exit
-
- Type: Builtin
-
- Default: n/a
-
- Usage: exit [ code ]
-
- Range: n/a
-
- About: exit leaves SKsh, returning execution back to the
- invoking shell. If invoked with a numeric argu-
- ment, it returns that exit code to the invoking
- shell or program.
-
- Note that exit always exits SKsh entirely. To
- simply exit a script or function, use the return
- statement. If the LOGOUT variable is defined,
- exit will execute that string before terminating.
-
- Example: exit # exits successfully
-
- See Also: return, LOGOUT
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 52 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: export
-
- Type: Builtin
-
- Default: n/a
-
- Usage: export [ -l ] [ var ... ]
-
- Range: n/a
-
- About: export (without the -l option) does two things.
- It sets the value of the indicated variables in
- the topmost symbol table in SKsh, and it sets an
- AmigaDos environment variable with the same name
- and value. This is the only way to transfer vari-
- able values between executions of SKsh.
-
- export with the -l option only sets the topmost
- symbol table of SKsh, but not the AmigaDos envi-
- ronment variable. This is faster and does not
- clutter up the environment with unneeded variable
- definitions.
-
- Example: export -l my_var1 my_var2
-
- See Also: getenv
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 53 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: expr
-
- Type: Keyword
-
- Default: n/a
-
- Usage: expr length string
- expr num_expression
- expr index str pattern
- expr substr num1 num2
-
- Range: n/a
-
- About: expr evaluates and prints the results of an
- expression.
-
- expr length string
-
- prints the length in characters of the string
-
- expr num_expression
-
- prints the result of evaluating num_expression.
- num_expression is an integer expression com-
- puted with 32 bit integers. '+', '-', '*',
- '/', and '%' can be used. '*', '/', and '%'
- have a higher precedence than '+' and '-'; oth-
- erwise, the expression is evaluated left to
- right. Parentheses can be used.
-
- expr index str pattern
-
- prints the index of pattern if found in the
- string, or 0 if not found. The first position
- in string is 1, not 0. Unlike ksh, pattern can
- be more than one character.
-
- expr substr string num1 num2
-
- prints the substring of the string starting at
- the position indicated by num1 and extending
- for num2 characters. The beginning of the
- string is at position one, not 0.
-
- Example: expr 3 * ( 1 + 4 )
- expr length "foo"
- expr index 'foobarnot' 'bar'
- expr substr 'foobarnot' 4 3
-
- See Also:
-
- _________________________________________________________________
-
-
- SKsh Amiga Shell Page 54 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: extname
-
- Type: Builtin
-
- Default: n/a
-
- Usage: extname [ -v ] [ fspec ]
-
- Range: n/a
-
- About: extname prints the "extension" of a given path
- name. For example, the extension of my_file.c is
- simply 'c'.
-
- When used with the "-v" flag, extname prints that
- part of the file name which is not in the
- extension.
-
- Example: extname my_file.c
-
- See Also: basename, dirname
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 55 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: false
-
- Type: Builtin
-
- Default: n/a
-
- Usage: false
-
- Range: n/a
-
- About: false simply returns a false exit code, and does
- nothing else.
-
- Example: if false
- then
- echo 'This will never echo'
- fi
-
- See Also: true
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 56 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: for/do/done
-
- Type: Keywords
-
- Default: n/a
-
- Usage: for var in list do stmt_list done
-
- Range: n/a
-
- About: The variable is set to each value in list, and for
- each value, the statement list is executed.
-
- Example: for file in *.h *.c
- do
- cp $file $file.bak
- done
-
- See Also: while
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 57 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: force
-
- Type: Keyword
-
- Default: n/a
-
- Usage: force [ -fba ] command [ parameter ... ]
-
- Range: n/a
-
- About: force forces SKsh to interpret command as a func-
- tion, builtin, or alias. Exactly one of the 'f',
- 'b', and 'a' flags must be present. force is use-
- ful if the builtin commands are redefined.
-
- Example: function date {
- echo -n 'The date is: '
- force -b date
- }
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 58 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: function
-
- Type: Keyword
-
- Default: n/a
-
- Usage: function name { stmt_list }
-
- Range: n/a
-
- About: function defines an SKsh function called name, and
- with the definition given by the statement list.
-
- Example: function my_func {
- echo "I was passed $# parameters"
- }
-
- See Also: functions
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 59 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: functions
-
- Type: Alias
-
- Default: set -f
-
- Usage: functions [ pattern... ]
-
- Range: n/a
-
- About: This alias lists defined functions. The pattern
- uses normal wildcards, but must be quoted to avoid
- being interpreted by the filename expansion
- mechanism. If the pattern is omitted, all func-
- tions are listed except those beginning with an
- underscore character (hidden functions).
-
- Only functions for the current context are listed,
- so this command may have a different effect inside
- of a subshell or function than when typed
- manually.
-
- Example: functions '[a-h]*'
-
- See Also: set
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 60 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: getenv
-
- Type: Builtin
-
- Default: n/a
-
- Usage: getenv [ var ... ]
-
- Range: n/a
-
- About: getenv imports the values of the indicated vari-
- able from AmigaDos environment variables with the
- same names. This command, coupled with export
- command, allows variables to be transferred be-
- tween executions of SKsh.
-
- Example: getenv my_var1 my_var2
-
- See Also: export
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 61 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: histhist
-
- Type: Script
-
- Default: n/a
-
- Usage: histlist
-
- Range: n/a
-
- About: histlist lists history files which have been saved
- with the histsave command.
-
- Example: histlist
-
- See Also: histsave, histrm, histload
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 62 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: histload
-
- Type: Script
-
- Default: n/a
-
- Usage: histload [ <f> ]
-
- Range: n/a
-
- About: histload loads the current shell history from a
- file saved with the savehist command. $CMDNUM is
- set appropriately.
-
- Example: histload session1
- histload myhist
-
- See Also: histsave, histrm, histlist
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 63 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: history
-
- Type: Builtin
-
- Default: n/a
-
- Usage: history [ -n ]
- history -e [ pattern | number | offset ]
- history -c
- history -l <histfile
-
- Range: n/a
-
- About: SKsh maintains the HISTSIZE previous commands in a
- list so that they may later be recalled or edited
- for re-execution.
-
- history with no parameters simply prints the his-
- tory list, with each line prefixed by the number
- of the associated command. The -n parameter
- leaves out the line numbers. History can be redi-
- rected to a file for later loading with the his-
- tory -l command (see below). History listed to
- the screen will not exteed the window width, but
- when directed to a file, the full width will be
- printed.
-
- history -e is used to execute commands from the
- history list. If given a positive numeric argu-
- ment, it executes the history command at that num-
- ber (note that these numbers are derived from CMD-
- NUM and do not always begin at 1 if CMDNUM > HIST-
- SIZE). If given a negative numeric argument, the
- line executed is the 'nth' before the current;
- thus, the example below executes the previous
- command. If the argument is a string or pattern,
- the most recent command containing that string or
- pattern is executed.
-
- history -c clears the existing history list, while
- maintaining the value of $CMDNUM.
-
- history -l <histfile reads a previously saved his-
- tory file into SKsh's internal history file. The
- histfile must be generated by redirecting a his-
- tory listing to a file (ie, history >histfile).
- SKsh will issue an error message if it cannot read
- the history file. The value of CMDNUM will be set
- according to its value in the file. None of the
- other history related variables (MAXDIST, etc)
- will be changed. This feature is useful to save
- history lists between invocations of SKsh.
-
-
- SKsh Amiga Shell Page 64 Reference Manual
-
-
-
-
-
-
-
-
-
-
- Example: history -e -1 # execute previous command
- history >myfile # save history in "myfile"
- history -l <myfile # load history from "myfile"
-
- See Also: HISTSIZE, !, !!, CMDNUM, command line editing in
- the User's Manual.
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 65 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: histrm
-
- Type: Script
-
- Default: n/a
-
- Usage: histrm
-
- Range: n/a
-
- About: histrm removes all history files which have been
- saved with the histsave command.
-
- Example: histrm
-
- See Also: histsave, histlist, histload
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 66 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: histsave
-
- Type: Script
-
- Default: n/a
-
- Usage: histsave [ <f> ]
-
- Range: n/a
-
- About: histsave saves the current shell history in a file
- named s:SKsh_Hist.<f>. If ommitted, <f> is the
- current $CLINUM string. History can later be re-
- loaded with the histload command.
-
- Example: histsave session1
- histsave myhist
-
- See Also: histload, histrm, histlist
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 67 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: HISTSIZE
-
- Type: Variable
-
- Default: 32
-
- Usage: $HISTSIZE
-
- Range: 0 to 32000
-
- About: SKsh keeps a list of the $HISTSIZE most recent
- commands available for editing and re-entry.
-
- Example: HISTSIZE=64
-
- See Also: history, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 68 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: HOME
-
- Type: Variable
-
- Default: :
-
- Usage: $HOME
-
- Range: n/a
-
- About: This variable represents the default destination
- for the cd command. It can be set to any valid
- directory name.
-
- Example: HOME=.
-
- See Also: cd
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 69 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: if/then/elif/else/fi
-
- Type: Keywords
-
- Default: n/a
-
- Usage: if expr then stmt_list
- [ [ elif expr then stmt_list ] ... ]
- [ else stmt_list ] fi
-
- Range: n/a
-
- About: If the expression is true (that is, it returns a
- zero exit status), then the first statement list
- is executed. If any elif statements are present,
- each expression is executed, and if it is true,
- execution procedes for the associated statement
- list. If none of the expressions were true, the
- else statement_list is executed.
-
- The expressions can be any command, or a test ex-
- pression surrounded by square brackets (see the
- user's manual for details).
-
- Example: if [ ! -f name -a ! -d name ]
- then
- mkdir name
- else
- echo "$name exists already!"
- fi
-
- See Also: while
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 70 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: IFS
-
- Type: Variable
-
- Default: " \n\t"
-
- Usage: $IFS
-
- Range: n/a
-
- About: Characters in IFS are used to break substituted
- text (from variables and command substitution)
- into parameters. If IFS is set to the null string
- (''), all substituted text will be a single
- parameter.
-
- If the 'i' option to SKsh is set (see the options
- command), the IFS characters will also be used to
- break text from $( ) style command substitution.
-
- Example: [dh0:]: IFS=" \n\t"
- [dh0:]: a='Now is the time'
- [dh0:]: echo $a
- Now is the time
- [dh0:]: IFS=''
- [dh0:]: echo $a
- Now is the time
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 71 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: inc
-
- Type: Builtin
-
- Default: n/a
-
- Usage: inc var [ count ]
-
- Range: n/a
-
- About: inc increments the contents of the variable by
- count, or 1 if count is not given. It is equiva-
- lent to, but faster than, 'var=$(expr $var +
- $count)'
-
- Example: inc my_var 3
-
- See Also: dec
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 72 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: info
-
- Type: Builtin
-
- Default: n/a
-
- Usage: info [ -a ] [ device | directory ] ...
-
- Range: n/a
-
- About: info reports the amount of free space available on
- a given device or directory. It prints total
- space in kilobytes, used space in kilobytes, the
- free space in kilobytes, the state of the device,
- the number of bytes per block, the percentage ca-
- pacity utilization, the total number of errors,
- and the volume name. If info is given a directory
- name as an argument, the free space for the direc-
- tory is the same as the free space for the device
- on which the directory resides.
-
- The SKsh info command reports data in 1024 byte
- kilobytes, not 1000 byte kilobytes. This may lead
- to a slightly different answer than other info
- commands. The SKsh info command will deal cor-
- rectly with file systems of up to several
- gigabytes (should you happen to have one of
- those).
-
-
- If the info command is given the -a flag, it will
- report information on all the currently mounted
- devices.
-
-
- Example: info sys: ram: df0:
- info -a # info for all devices
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 73 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: INTERACTIVE
-
- Type: Variable
-
- Default: TRUE for interactive sessions
- FALSE otherwise
-
- Usage: $INTERACTIVE
-
- Range: TRUE or FALSE
-
- About: This variable stores the string "TRUE" if this
- SKsh session is interactive, and "FALSE"
- otherwise. For example, if SKsh is started via:
-
- sksh -c "mycommand string"
- or
- sksh myscript.sksh
-
- the INTERACTIVE variable will contain "FALSE", as
- SKsh will simply execute the commands or scripts
- and exit immediately thereafter. However, if SKsh
- is started such that the prompt is displayed and
- commands may be typed from the keyboard,
- INTERACTIVE will be set to TRUE.
-
- Currently, the .skshrc file is not sourced for
- non-interactive sessions. This is to prevent any
- output from the .skshrc from appearing when not
- desired. However, an unfortunate side-effect of
- this is that any aliases, functions, and variables
- set up in the .skshrc file are not available to
- the non-interactive invocation of SKsh. The
- INTERACTIVE variable is intended to provide a
- workaround for this problem. It can be tested for
- in the .skshrc file, and certain actions can take
- place only for interactive sessions (See the
- example below).
-
- In SKsh 1.6, the .skshrc file is still not sourced
- for non-interactive sessions. However, this will
- change in SKsh 1.7, so you should modify your
- .skshrc file accordingly.
-
- Example: The following can be used as a test in .skshrc:
-
- if [ "$INTERACTIVE" = 'true' ]
- then
- echo "\nWelcome to SKsh\n"
- fi
-
- Notes: You may also want to put the following statements,
-
-
- SKsh Amiga Shell Page 74 Reference Manual
-
-
-
-
-
-
-
-
-
- if used, inside the interactive test:
-
- complist
- cilist
- statements which set HISTSIZE, MAXDIST,
- function key variables, etc.
-
- See Also: sksh, SKSHINIT
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 75 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: LASTRC
-
- Type: Variable
-
- Default: n/a
-
- Usage: $LASTRC
-
- Range: n/a
-
- About: LASTRC stores the return code from the last exter-
- nal command which was executed. It is not reset
- by subsequent internal command return codes, as is
- $?.
-
- Example: some_external_command
- echo
- if [ $LASTRC -ne 0 ]
- then
- echo 'command failed!'
- fi
-
- See Also: $?
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 76 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: line
-
- Type: Builtin
-
- Default: n/a
-
- Usage: line var [ prompt [ pnpc ] ]
-
- Range: n/a
-
- About: The line command functions similar to read, but
- allows the use of the full SKsh command line edit-
- ing facilities to input lines. line may only in-
- put lines from the keyboard, not a file. The syn-
- tax is:
-
- line var [ prompt ] [ pnpc ]
-
- Where pnpc is similar to the PNPC variable, but
- for this prompt. (See the PNPC entry in
- Reference.doc for details).
-
- line is recommended instead of read wherever input
- is to always be read from the keyboard.
-
- Example: line myvar "${_ANSI_P3}My prompt >$_ANSI_P1 " 20
- echo "$myvar"
-
- line myvar "My propmt > "
- echo "$myvar"
-
- See Also: read
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 77 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: LINES
-
- Type: Variable
-
- Default: 24
-
- Usage: $LINES
-
- Range: 3 to anything
-
- About: This variable is currently not used by SKsh; it is
- provided for future expansion, and for other ap-
- plications or programs which might be interested.
-
- This variable is automatically set by SKsh when
- the window is resized. This behavior can be
- turned off with the options command.
-
- Example: if [ $LINES -lt 20 ]
- then
- echo "We require at least 20 lines!"
- fi
-
- See Also: COLUMNS, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 78 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: ll
-
- Type: Alias
-
- Default: ls -lbF
-
- Usage: ll [ file | dir ] ...
-
- Range: n/a
-
- About: ll prints a long format directory listing, with
- only the basename of each file printed. Note that
- the 'F' option to 'ls' is set.
-
- Example: ll s:
-
- See Also: dir, ls
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 79 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: LLMIN
-
- Type: Variable
-
- Default: 4
-
- Usage: $LLMIN
-
- Range: 0 to 1023 inclusive
-
- About: LLMIN stores the minimum command line length for
- which SKsh will store the line in the history
- list. Put another way, lines shorter than this
- value are not inserted into the history list. For
- example, a line containing only "cd" would be ig-
- nored, as it is just as easy to re-type as it is
- to search for in the history list.
-
- Example: LLMIN=0 # don't ignore any lines, even short ones
-
- See Also: MAXDIST, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 80 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: local
-
- Type: Builtin
-
- Default: n/a
-
- Usage: local [ varname ... ]
-
- Range: n/a
-
- About: The local command can be used to enforce the cre-
- ation of local variables if the 'N' option and the
- 'l' to SKsh are set (see the options command).
- Normally with the 'N' option set, local variables
- are created only if they had not been created
- first in an enclosing context. The local command
- makes them local even if there had been a previ-
- ously defined variable of the same name in an en-
- closing context. Note that this command will have
- no effect if SKsh local variables are disabled by
- turning off the 'l' option.
-
- Example: function my_func {
- local answer;
- answer = 42
- }
-
- See Also: options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 81 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: LOGOUT
-
- Type: Variable
-
- Default: 'echo "\nBye!\n"'
-
- Usage: $LOGOUT
-
- Range: n/a
-
- About: The text of this variable is executed by SKsh when
- the exit command is used to terminate execution.
-
- Example: LOGOUT=''; # do nothing
-
- See Also: exit
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 82 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: ls
-
- Type: Builtin
-
- Default: n/a
-
- Usage: ls [ -aldhi1bvF ] [ dirname | fname ] ...
-
- Range: n/a
-
- About: This command is used to obtain information about
- files or directories. With no arguments, it sim-
- ply lists the contents of the current working di-
- rectory, leaving out files beginning with a dot.
- If the 'I' option to SKsh is set (see the options
- command), all .info files are also left out (this
- feature exists because I hate .info files).
-
- The 'a' option causes ls to list files beginning
- with a dot. Similarly, the 'i' option lists .info
- files even if the 'I' option to SKsh is set. The
- 'h' option lists files with the hidden bit set.
-
- The 'l' option creates a long format list, with
- filename, protection status, byte size, block
- size, and modification date listed. (The ll com-
- mand has been aliased to 'ls -l' to make this
- easier).
-
- The '1' option creates a short format list with
- one column instead of three (useful for piping
- filenames into a command).
-
- The 'd' option forces directories to be printed as
- such. Normally if the ls command is given a di-
- rectory as an argument, it prints the contents of
- that directory. The 'd' option prints information
- on the directory itself. This is useful with the
- 'l' option to find the modification date or pro-
- tection status of a directory.
-
- The 'b' option causes only the basename of each
- file to be printed. Normally, if a path to a file
- is given, SKsh will print the path information in
- each entry in the ls output. The 'b' option
- leaves out the path information, printing only the
- basename.
-
- The 'v' option prints a count of entries listed
- after the listing itself. Also, a total byte
- count is printed, which is the sum of the sizes of
- each file listed.
-
-
- SKsh Amiga Shell Page 83 Reference Manual
-
-
-
-
-
-
-
-
-
-
- The 'F' option instructs 'ls' to output the appro-
- priate _FILE_S, _FILE_E, _DIR_S, _DIR_E, _EXEC_S,
- and _EXEC_E variables before and after each file
- name printed in either the short or long directory
- format. See the documentation on those variables
- for details on their usage.
-
- The short form of the ls command normally prints
- the files in columns. To decide how many columns
- there should be, it examines the $COLUMNS vari-
- able, divides the result by the length of the
- longest file name to be printed, and insures at
- least a three character gutter between columns.
-
- The ls command outputs an error message if passed
- an argument which does not exist as a file or
- directory.
-
- Example: ls -li my_dir # list my_dir including info files
-
- See Also: options, dir, ll
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 84 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: man
-
- Type: Script
-
- Default: n/a
-
- Usage: man man_entry
-
- Range: n/a
-
- About: man is used to display entries from the MAN:
- directory. MAN: should be set up to a directory
- containing *.doc, *.man, and *.txt files. If man
- files a file with the passed in prefix and one of
- the above suffixes, it will display that entry us-
- ing either "more", or the program name stored in
- the PAGER variable, if set. For example, to exam-
- ine man entries with the "sys:usr/bin/less" pro-
- gram, set PAGER to "sys:usr/bin/less".
-
- Most free software comes with some sort of "RE-
- ADME" or documentation file; these can be copied
- into the MAN: directory under the name <prog>.MAN,
- where <prog> is the name of the software package.
- These files can then be conveniently retrieved
- with the man command.
-
- Example: man myprog
-
- See Also: PAGER
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 85 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: MANPATH
-
- Type: Variable
-
- Default: MAN:,MAN:SKsh
-
- Usage: $MANPATH
-
- Range: n/a
-
- About: If MANPATH is set to a list of comma separated
- list of directory names, the man command will
- search those directories for manpage entries. The
- MANPATH variable should not be set directly, but
- rather, be set through the -man option to the path
- command.
-
- Example: path -man -add MAN:subdir1 MAN:subdir2
- man myfile1 # myfile1 is in MAN:subdir1 or 2
-
- See Also: man, path
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 86 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: match
-
- Type: Builtin
-
- Default: n/a
-
- Usage: match [ -v ] pattern [ string ... ]
-
- Range: n/a
-
- About: match prints each string that matches the pattern
- given in the first argument. The pattern is of
- the same type used by SKsh for filename wildcards,
- but it must be quoted to avoid being expanded in
- that manner. If the 'v' flag is set, only strings
- not matching the pattern are printed.
-
- Example: match '*.[ch]' file1.foo file1.c file2.h my_file
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 87 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: MAXDIST
-
- Type: Variable
-
- Default: 5
-
- Usage: $MAXDIST
-
- Range: 0 to 32000 inclusive
-
- About: When a command is entered from the keyboard with
- line editing enabled, SKsh checks for an identical
- line in the history list. If one is found less
- than $MAXDIST lines away, the new one is not en-
- tered into the history list. This has two benefi-
- cial effects. First, if the same command is en-
- tered several times in a row, it will only appear
- once in the history list. Second, commands which
- have not been entered for a long time will be en-
- tered again so they do not scroll of the end of
- the list. This rule applies whether the command
- was typed or accessed from a previous history list
- entry.
-
- Example: MAXDIST=10 # re-enter lines if they get too far
-
- See Also: LLMIN, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 88 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: mem
-
- Type: Builtin
-
- Default: n/a
-
- Usage: mem [ -tcf ]
-
- Range: n/a
-
- About: mem reports the amount of free chip and fast
- memory, as well as a total. If the 't' flag is
- set, only the total is printed. If the 'c' is
- set, only chip memory is listed, and if the 'f'
- flag is set, only fast memory is listed.
-
- Example: if [ $(mem -t) -lt 400000 ]
- then
- echo 'you must have at least 400K free'
- fi
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 89 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: mkdir
-
- Type: Builtin
-
- Default: n/a
-
- Usage: mkdir [ dirname ... ]
-
- Range: n/a
-
- About: mkdir creates directories with names identical to
- the parameters passed to it.
-
- Example: mkdir my_dir sys:system/my_other_dir
-
- See Also: rmdir
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 90 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: mplist
-
- Type: Builtin
-
- Default: -l option
-
- Usage: mplist [ -adrel ] [ name=name ... ]
-
- Range: n/a
-
- About: The mplist (mount-point list) command provides a
- very limited name mapping facility. For example,
- you might map "/df1" to "df1:", so that a refer-
- ence to the file "/df1/myfile" really references
- "df1:myfile".
-
- There are currently many restrictions to this com-
- mand, and it is intended as only a stopgap measure
- until AmigaDos supports symbolic links. The
- mplist command will not work operate nicely with
- file completion, and the entire prefix must be
- given for the mapping to take place.
-
- Arguments added to the mplist are in the form
- "name=name", where the first name is the source
- for the mapping, and the second is the
- destination. All arguments must be single or
- double quoted.
-
- -a Add the supplied arguments to the mplist.
- The old contents of the list are left in
- place.
-
- -d Delete the supplied arguments from the
- mplist.
-
- -r Synonym for -d.
-
- -e Empty the mplist.
-
- -l List the contents of the mplist, one name per
- line. If no command line switches are given,
- this is the default.
-
- Hints: Please note the following:
-
- * The patterns added to the mplist must be
- single or double quoted.
-
- * The first part of mplist entry (before the =
- sign) must match a portion of a filename
- exactly.
-
-
- SKsh Amiga Shell Page 91 Reference Manual
-
-
-
-
-
-
-
-
-
-
- * The mplist can be null if you don't wish to
- use this feature.
-
- * The mplist can map any unquoted argument to
- any string. It does not have to be used for
- directory names only.
-
-
- Example: mplist -e # empty the mplist
- # now map /usr/df0 to df0:, and /ram to ram:
- mplist -a '/usr/df0=df0:' '/ram=ram:'
-
- mplist -a 'd1=sys:usr/commands/src/directory-one'
- cd d1 # cd's to the above directory.
-
- See Also: CDPATH
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 92 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: mv
-
- Type: Builtin
-
- Default: n/a
-
- Usage: mv [ -v ] source1 [ source2 ... ] destination
-
- Range: n/a
-
- About: mv moves files or directories by renaming them.
- Thus, it cannot be used to move data cross
- devices. If more than one source is given, the
- destination must be a directory or nonexistant.
- If it is nonexistant, it is created as a
- directory.
-
- The -v option prints the name of each file as it
- is moved.
-
- mv resets the archive bit of all files which it
- moves.
-
- Example: mv my_dir sys:another_dir/my_other_dir
-
- See Also: cp
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 93 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: numloop/do/done
-
- Type: Keywords
-
- Default: n/a
-
- Usage: numloop var = num1 num2 [ num3 ] do stmt_list done
-
- Range: n/a
-
- About: The variable is set to num1 (which must be a
- numeric value), and counts through num2 using a
- step size of num3. Num3 defaults to 1. If num3
- is positive, num2 must be greater than num1, and
- vice verca.
-
- Infinite loops are not checked for.
-
- Example: numloop a = 0 25 5
- do
- echo $a
- done
-
- See Also: for, while
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 94 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: OLDPWD
-
- Type: Variable
-
- Default: old present working directory string
-
- Usage: $OLDPWD
-
- Range: n/a
-
- About: When the present working directory is changed,
- SKsh puts the old PWD value into OLDPWD. The cd -
- p command can be used to return to OLDPWD.
-
- Example: echo $PWD; cd c:; echo $OLDPWD
-
- See Also: PWD, pwd, cd
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 95 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: options
-
- Type: Builtin
-
- Default: n/a
-
- Usage: options [ -opts | +opts | opts ] ...
-
- Range: n/a
-
- About: The options command provides a way to change the
- default behavior of SKsh in a number of areas. If
- the command is entered with no parameters, simply
- prints the current options string, which is a se-
- ries of letters and digits. Otherwise, it exam-
- ines each parameter in turn. Each parameter can
- begin with a '+' or '-'; a '+' turns "on" the op-
- tions corresponding each letter, and a '-' turns
- them "off". In addition, if neither '+' or '-' is
- present, the flags are set to the listed options.
-
- +1 Set the overstrike/insert mode back to the
- default value after a return. If this flag
- is not set, the overstrike/insert mode re-
- mains set to what it was previously.
-
- +2 If set, try to execute AmigaDos 2.0 commands
- using "Runcommand". This doesn't work quite
- right in Sksh 1.7, and the flag is reset by
- default. It may be set by default later.
-
- +c If set, SKsh wildcard expansion, filename
- completion, and a few other features will be
- case independent. If unset, they will be
- case dependent.
-
- +e If set, disable command line editing. This
- might be useful for using SKsh from a termi-
- nal that does not support the ANSI escape se-
- quences SKsh uses for line editing. Note
- that is flag is SET in .skshinit. You must
- reset it in .skshrc if you wish to use line
- editing (the .skshrc file supplied with SKsh
- does this).
-
- +f If set, disable wildcard filename expansion.
-
- +h If set, always create a new history line,
- even if an old command was executed with
- 'history -e' or the interactive editing
- facility. If not set, executing old lines
- will not create a new history entry.
-
-
- SKsh Amiga Shell Page 96 Reference Manual
-
-
-
-
-
-
-
-
-
-
- +i If set, use IFS to split $( ) command substi-
- tution text, much as it is used to split
- variable value expansion text.
-
- +l If set, variables referenced in functions or
- parenthetical subshells will be local (al-
- though this also depends on the 'n' option).
- If not set, there will be no local variables.
- Note that resetting this flag may have large
- side effects when running scripts and
- functions. The advantage is that it takes
- less memory and is faster.
-
- +n If set, only read scripts, but do not execute
- their commands. This is ignored for interac-
- tive use.
-
- +p If set, use the exec prompt string mode.
- This tells sksh not to use the prompt string
- as the prompt directly, but rather to pass it
- through the command interpreter first, and
- use the results as the prompt. This is
- slower, but more powerful.
-
- +s If set, sort filename parameters from
- wildcard expansion.
-
- +v If set, variable expansions which contain
- wildcard characters will use those wildcard
- characters in filename matching. For ex-
- ample, if the "foo" variable contains "*",
- then "echo $foo.bar" would echo any file name
- ending with ".bar". If the v flag is RESET,
- then it would simply echo "*.bar"; ie, the
- value of the variable would be substituted
- but ignored for filename matching.
-
- +w If set, SKsh will use the dwclist to selec-
- tively bypass wildcard file expansion on a
- command by command basis. It is reset by
- default.
-
- +x If set, print each lines as it is executed.
- Moderately useful for debugging scripts.
-
- +C Enable the internal completion list. See the
- complist command for details. If reset, the
- internal completion list will be ignored.
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 97 Reference Manual
-
-
-
-
-
-
-
-
-
- +F If set, map UNIX style filenames to AmigaDos
- style file names. A leading '/' becomes a
- ':', a '~' inserts the contents of the HOME
- variable, a '.' becomes the current direc-
- tory, and two dots become a slash.
-
- +H If set, lines executed with history -e will
- be printed before they are executed.
-
- +I If set, leave out the .info files from direc-
- tory listings unless the 'i' option to 'ls'
- is explicitly set.
-
- +N Create new variables in a subshell or func-
- tion only if a variable with the same name
- does not exist in an outer context. If one
- does exist, that one will be used instead of
- making a new local variable. This flag
- changes the scoping rules, and can have a
- large effect in the execution of scripts and
- functions; it should be used with care.
-
- +O Use overstrike instead of insert mode as the
- default for command line editing.
-
- +P If set, ^r history searches and 'history -e'
- style history access will only match lines
- beginning with the given string. If unset,
- the string can match any location within a
- history line.
-
- +R Disable automatic setting of LINES and COL-
- UMNS variables. Normally, these variables
- are set after the window is re-sized at the
- next interactive prompt. To set them manu-
- ally and not be overridden by SKsh, use this
- options flag.
-
- +S Insert a single blank line before and after
- the prompt when typing commands
- interactively. For interlace screens where
- more than 36 or so lines are displayed, using
- the S option can create a more visually ap-
- pealing and "tidy" display.
-
- +U The U option, if set, causes SKsh to use a
- requester if a component of the path contains
- an unmounted volume. This also affects sev-
- eral other areas, such as the '-m' test
- expression.
-
-
-
-
-
-
- SKsh Amiga Shell Page 98 Reference Manual
-
-
-
-
-
-
-
-
-
- Example: # see which options are turned on:
- options
- # reset all options:
- options $(echo -c - '-' $(options))
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 99 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: OS_VER
-
- Type: Variable
-
- Default: n/a
-
- Usage: $OS_VER
-
- Range: n/a
-
- About: This variable contains either the string "1.3" or
- the string "2.0", depending on which AmigaDos
- revision SKsh is being run under.
-
- Example: if [ "$OS_VER" != '2.0' ]
- then
- echo 'This script runs only under AmigaDos 2.0'
- return 1
- fi
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 100 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PAGER
-
- Type: Variable
-
- Default: Unset
-
- Usage: $PAGER
-
- Range: legal executable name
-
- About: The PAGER variable is used by the man function.
- If set to an AmigaDos executable, that executable
- is used as a pager. If unset, more is used by
- default. PAGER should be set to a command which
- does not exit until you are done examining the
- file. Any command which detaches itself from the
- invoking process should not be used as a PAGER.
-
- Example: PAGER=vi
- man file
-
- See Also: man
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 101 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PATH
-
- Type: Variable
-
- Default: 'skshbin:,skshscr:,.,c:'
-
- Usage: $PATH
-
- Range: n/a
-
- About: This variable contains a comma separated list of
- directory names. When SKsh executes a file, it
- searches for it in these directories. Note that
- the current working directory must be specified
- explicitly ("."). This lets you change the order
- of the search. For example, you could move "." to
- the end of the path to search it last. The direc-
- tory names in the path do not need to be termi-
- nated by a slash; SKsh will add one if it is not
- there.
-
- If SKsh finds the file name in the search path,
- and the file has its script bit set, SKsh will at-
- tempt to execute this file as a script instead of
- a binary.
-
- The PATH variable is also used by the which and
- whence commands.
-
- Entries in the path which are on currently un-
- mounted devices are bypassed silently, although
- this behavior can be changed with the options
- command.
-
- The PATH variable should not be modified explic-
- itly, but rather, though the use of the path
- script, also described herein.
-
- Example: c:run $(which emacs) my_file
-
- See Also: path, which, whence
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 102 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: path
-
- Type: Function
-
- Default: see the .skshinit file
-
- Usage: path [ -cd | -path | -man ] [ -add ] dir1,dir2,...
-
- Range: n/a
-
- About: This function is provided to make the PATH,
- MANPATH, and CDPATH variables easier to set up and
- manipulate.
-
- With no arguments, path simply prints the current
- search path definition (but not the cd path).
-
- With the -cd option and no other arguments, path
- prints the current cd path. Similary, the -man
- option prints the man path.
-
- If given a set of directory names but no -add op-
- tion, path sets the given path variable to the
- concatenation of the values given. No duplicate
- items will be added. The search path will always
- contain the skshbin:, skshscr:, c:, and . directo-
- ries so these need not be added separately. The
- man path will always contain MAN: and MAN:SKsh.
-
- The -add option may be used with or without the -
- man and -cd options. It causes each directory in
- the list to be added to the appropriate path with-
- out erasing the previous contents of the variable.
- Duplicate values will not be added.
-
- Each directory argument can be either a single di-
- rectory or a comma separated list of directories.
-
- Example: path -add sys:bin sys:pd/bin
- path -cd -add sys:usr,sys:mydir sys:anotherdir
- path -man -add MAN:subdir1
-
- See Also: PATH, CDPATH, MANPATH
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 103 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: pathconv
-
- Type: Builtin
-
- Default: n/a
-
- Usage: pathconv [ -a | -u ] [ fspec ... ]
-
- Range: n/a
-
- About: pathconv provides a mechanism for converting
- strings from AmigaDos style file names to Unix
- style file names, and vice verca.
-
- The -a option converts filenames to AmigaDos
- style. If neither -a nor -u is given, -a is the
- default.
-
- The -u option converts filenames to Unix style.
-
- Note that arguments to pathconv should be quoted
- to avoid being changed by the shell's normal
- behavior.
-
- Example: [prompt]: ROOT=sys:
- [prompt]: pathconv -a '/usr/bin/vi'
- sys:usr/bin/vi
- [prompt]: pathconv -u 'sys:usr/bin/vi'
- /usr/bin/vi
-
- [prompt]: pathconv -a '../../../myfile'
- ///myfile
- [prompt]: pathconv -u '///myfile'
- ../../../myfile
-
- Notes: The +F option must be set for the pathconv command
- to have any effect. See the options command.
-
- The exact behavior ofthe pathconv command will
- depend on several variables, including ROOT and
- HOME.
-
- See Also: options, ROOT
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 104 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PNPC
-
- Type: Variable
-
- Default: 61
-
- Usage: $PNPC
-
- Range: 0 to 127
-
- About: This variable is one of several responsible for
- controlling the actions of SKsh line editing and
- display output. PNPC tells SKsh how many non-
- printing control characters there are in the cur-
- rently defined prompt strings (both PS1 and PS2).
- SKsh needs to know this so that it can find the
- actual printing width of the prompt string from
- the actual character length. You will only have
- to change PNPC if you change the number of ANSI
- control sequences in your prompt.
-
- Example: PNPC=0
-
- See Also: COLUMNS, PS1, PS2, PNPC2, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 105 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PNPC2
-
- Type: Variable
-
- Default: 21
-
- Usage: $PNPC2
-
- Range: 0 to 127
-
- About: This variable is similar to PNPC, but for the sec-
- ondary prompt string. See PNPC for details. Hav-
- ing separate variables enables PS1 and PS2 to con-
- tain different numbers of escape sequences.
-
- Example: PNPC2=0
-
- See Also: COLUMNS, PS1, PS2, PNPC, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 106 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: popd
-
- Type: Script
-
- Default: n/a
-
- Usage: popd
-
- Range: n/a
-
- About: The popd script pops the top directory off the di-
- rectory stack and "cd"s to that location. The
- DIRSTACK variable should never be modified manu-
- ally, but only through the directory stack func-
- tions listed below.
-
- Example: pushd sys:utilities # push directory
- pushd ram:
- pushd sys:system
- popd # back to ram:
- popd # back to sys:utilities
- popd # back to previous dir
-
- See Also: pushd, dstack, cleard, DIRSTACK
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 107 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: preparse
-
- Type: Builtin
-
- Default: n/a
-
- Usage: preparse < infile > outfile
-
- Range: n/a
-
- About: preparse reads a legal SKsh script from its stan-
- dard input and produces a "preparsed" file on its
- standard output. This preparsed file can then be
- read back into SKsh much (2 to 3 times) faster
- than a normal SKsh script file. The preparsed
- file acts just like a script file; if it has its
- script bit set, it can be automatically executed
- by typing its name. It can also be sourced. How-
- ever, it is not in a human readable format.
-
- SKsh guarantees that script files will be upwardly
- compatible between versions of SKsh; however,
- preparsed files will not be. Therefore, the
- source scripts must be retained.
-
- SKsh will automatically detect preparsed versions
- of the .skshinit and .skshrc files (called
- .skshinit.pp and .skshrc.pp) and use those if they
- exist. This can dramatically reduce SKsh invoca-
- tion time.
-
- SKsh will issue an error message if you try to ex-
- ecute a preparsed file from an old version of
- SKsh.
-
- Preparsing files will probably make a significant
- difference only if the file is later read from a
- hard disk or a ram drive. From a floppy, SKsh can
- parse the file nearly as fast as the floppy can
- read it.
-
- Example: preparse < Stuff.sksh > Stuff.sksh.pp
-
- See Also: Addendum1.5.doc for an example of how to source
- other preparesed files from your .skshrc file.
-
- _________________________________________________________________
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 108 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: printf
-
- Type: Builtin
-
- Default: n/a
-
- Usage: printf formatstring parameters...
-
- Range: n/a
-
- About: printf is similar to the C function of the same
- name. The first parameters is the format string,
- and the rest are inserted appropriately. Note
- that there are no associated fprintf and sprintf
- functions, as those can be easily accomplished
- with "var=$(printf)" or "printf >>file".
-
- The echo statement should be used when no format-
- ting is needed.
-
- Notes: To print integers, "%ld" should always be used in-
- stead of "%d".
-
- The "%c" option does not work. Instead, use %s
- with a one character string.
-
- Any argument beginning with "-" or a digit will be
- converted to a 32 bit integer before being passed
- to printf. This is necessary as SKsh stores all
- values internally as strings. If you wish to use
- such a parameter with the "%s" format, prefix it
- with a leading space.
-
- The result string must fit within one SKsh token
- (1023 characters). SKsh does not check for over-
- flow, so it would be advisable to heed this limit.
-
- Example: printf "Test: %10s %5ld" FOO 42
-
- See Also: echo
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 109 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: ps
-
- Type: Builtin
-
- Default: n/a
-
- Usage: ps
-
- Range: n/a
-
- About: ps prints, for each CLI process, the process num-
- ber, the address of the process, the priority of
- the process, the command name associated with the
- process, and the current working directory for the
- process.
-
- Example: ps
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 110 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PS1
-
- Type: Variable
-
- Default: $_ANSI_P3[$_ANSI_P2$CLINUM$_ANSI_P3|$_ANSI_P2\
- $CMDNUM$_ANSI_P3|$PWD]: $_ANSI_P1
-
- Usage: $PS1
-
- Range: n/a
-
- About: This variable controls the primary prompt string
- displayed by SKsh. If the 'p' SKsh option is not
- set (see options), SKsh expands the variables in
- the string, and outputs it as the primary prompt.
- For this reason, PS1 should be defined to a single
- quoted string, so that the variables are expanded
- at the proper time and not when PS1 is defined.
-
- If the 'p' option to SKsh is set, SKsh sends the
- contents of the PS1 variable through the command
- interpreter, and displays the result as the pri-
- mary prompt. In this case, PS1 should contain a
- string which when executed, will print the desired
- prompt. This is slower than the default method
- above.
-
- Example: PS1='$ '; PNPC=0
-
- See Also: PS2, PNPC, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 111 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PS2
-
- Type: Variable
-
- Default: '$_ANSI_P3> $_ANSI_P1'
-
- Usage: $PS2
-
- Range: n/a
-
- About: This variable controls the secondary prompt string
- displayed by SKsh. This is the prompt string dis-
- played when SKsh expects more input, such as the
- continuation of a for statement or unterminated
- string.
-
- If the 'p' SKsh option is not set (see options),
- SKsh expands the variables in the string, and out-
- puts it as the secondary prompt. For this reason,
- PS2 should be defined to a single quoted string,
- so that the variables are expanded at the proper
- time and not when PS2 is defined.
-
- If the 'p' option to SKsh is set, SKsh sends the
- contents of the PS2 variable through the command
- interpreter, and displays the result as the sec-
- ondary prompt. In this case, PS2 should contain a
- string which when executed, will print the desired
- prompt. This is slower than the default method
- above.
-
- Example: PS2=': '; PNPC=0
-
- See Also: PS1, PNPC, options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 112 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: pushd
-
- Type: Script
-
- Default: n/a
-
- Usage: pushd new_dir
-
- Range: n/a
-
- About: The pushd script "cd"s to new_dir and pushes the
- old directory on the director stack for later re-
- trieval with the popd script. The DIRSTACK vari-
- able should never be modified manually, but only
- through the directory stack functions listed
- below.
-
- Example: pushd sys:utilities # push directory
- pushd ram:
- pushd sys:system
- popd # back to ram:
- popd # back to sys:utilities
- popd # back to previous dir
-
- See Also: popd, dstack, cleard, DIRSTACK
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 113 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: PWD
-
- Type: Variable
-
- Default: present working directory string
-
- Usage: $PWD
-
- Range: n/a
-
- About: SKsh maintains the contents of this variable such
- that it always represents the current working
- directory.
-
- Example: old_dir="$PWD"; # save old directory
-
- See Also: OLDPWD, BPWD, pwd, cd
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 114 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: pwd
-
- Type: Alias
-
- Default: echo "$PWD"
-
- Usage: pwd
-
- Range: n/a
-
- About: This alias simply prints the present working di-
- rectory string.
-
- Example: pwd
-
- See Also: PWD, OLDPWD
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 115 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: qrm
-
- Type: Script
-
- Default: n/a
-
- Usage: pwd
-
- Range: n/a
-
- About: qrm is like the rm function, but before each file
- it prompts for whether the file should be deleted.
-
- Example: qrm *.o
-
- See Also: rm
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 116 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: quit
-
- Type: Alias
-
- Default: LOGOUT=""; exit
-
- Usage: pwd
-
- Range: n/a
-
- About: quit is like exit but does not execute the value
- of the LOGOUT variable first.
-
- Example: pwd
-
- See Also: exit, logout, LOGOUT
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 117 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: read
-
- Type: Builtin
-
- Default: n/a
-
- Usage: read var
-
- Range: n/a
-
- About: The read command sets the value of the variable by
- reading exactly one command from the standard
- input. This can be used to accept input from the
- keyboard, or it can have its own standard input
- redirected to read lines from a file. Read re-
- turns a non-zero return code when it encounters an
- end-of-file; this is useful in loops.
-
- Example: while read in_line
- do
- echo "We read: $in_line"
- done < my_input_file.txt
-
- See Also: line
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 118 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: RECUR_DEPTH
-
- Type: Variable
-
- Default: 16
-
- Usage: $RECUR_DEPTH
-
- Range: 12 <= RECUR_DEPTH <= 128
-
- About: This variable is set to the maximum number of
- times that the SKsh parser will recurse before is-
- suing an error message. The default is probably
- fine for most applications, but to deeply nest
- scripts or functions you may have to increase the
- number. Complex test statements or large numbers
- of connected '&&' and '||' clauses may also need
- larger recursion depths.
-
- If you increase this beyond the default, you will
- also need to increase the stack size.
-
- Example: RECUR_DEPTH=32;
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 119 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: resident
-
- Type: Builtin
-
- Default: n/a
-
- Usage: resident [ -l ]
- resident [ -a | -d ] [ progname ... ]
-
- Range: n/a
-
- About: The resident command can be used to examine the
- resident list, add programs to it, or delete pro-
- grams from it. "resident" with no arguments or
- with the "-l" flag lists the programs currently on
- the resident list. The -a flag adds the named
- programs to the resident list; the whole path to
- the file must be given, although only the basename
- is remembered. Resident -d deletes programs from
- the resident list.
-
- Example: resident -a /bin/view # add view to res list
- resident -l # list resident list
-
- See Also: which
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 120 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: return
-
- Type: Builtin
-
- Default: n/a
-
- Usage: return [ code ] [ level ]
-
- Range: n/a
-
- About: The return command exits from an enclosing script,
- subshell, or function with exit code <code> (0 by
- default). An optional second argument will return
- from <level> nested levels of scripts, subshells,
- or functions.
-
- Example: ( echo foo; return; echo 'This is not echoed' )
-
- See Also: continue, break
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 121 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: rm
-
- Type: Builtin
-
- Default: n/a
-
- Usage: rm [ -rvf ] [ file | dir ] ...
-
- Range: n/a
-
- About: This command simply removes the named files. It
- will not remove directories unless the '-r' flag
- is used; use rmdir to remove a single, empty
- directory.
-
- The '-r' flag causes 'rm' to recursively remove
- everything under each directory. This is somewhat
- dangerous; care should be used.
-
- The '-v' flag prints the name of each file as it
- is removed.
-
- The '-f' flag will perform a "chmod +wd" on each
- file or directory before deletion.
-
- Example: rm scrap_file.c
-
- See Also: rmdir
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 122 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: rmdir
-
- Type: Builtin
-
- Default: n/a
-
- Usage: rmdir [ dir ... ]
-
- Range: n/a
-
- About: This command simply removes the named directories.
- It will not remove files or directories which are
- not empty.
-
- Example: rmdir scrap_dir
-
- See Also: rmdir
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 123 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: ROOT
-
- Type: Variable
-
- Default: ":"
-
- Usage: path names beginning with '/'
-
- Range: Any legal directory or filesystem device name
-
- About: When Un*x filename mapping is used (see the op-
- tions command), SKsh replaces a leading slash with
- the contents of this variable. It is normally a
- colon, which makes the path name become relative
- to the "root" of the current device. However, it
- can be set to any directory or filesystem device
- name. For example, if set to "sys:", all file
- references beginning with a slash will become
- relative to 'sys:', even if the current working
- directory is on another device. If can also be
- set to a subdirectory of a device, as in the ex-
- ample below, in which case it must end with a
- slash.
-
- Example: ROOT=sys:usr/work/ # make this the new "root"
-
- See Also: options
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 124 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: set
-
- Type: Builtin
-
- Default: n/a
-
- Usage: set [ -tfabvs ] [ pattern ... ]
-
- Range: n/a
-
- About: With no options, set lists each variable and its
- definition. If pattern arguments, each one is
- listed. The 'f' options forces interpretation as
- function names, the 'a' option as alias names, the
- 'b' option as builtin command names, and the 'v'
- option as variables names (the default).
-
- The 's' option leaves out the definition, printing
- only the name on a single line. In any case,
- function definitions are not listed in this ver-
- sion of SKsh. If the 's' option is used, the 'v'
- option must explicitly be set to list variables.
- Also, more than one of 'f', 'a', 'b', and 'v' may
- be set.
-
- SKsh will not list any function, alias, builtin,
- or variable whose name begins with an underscore
- (hidden variables, etc). This is useful to either
- hide definitions from users, or in cases where
- printing the contents of a variable would corrupt
- the display (such as the _ANSI_CLEAR variable).
-
- The definition of builtin commands is printed as a
- short description of the command.
-
- The set command cannot be used to set variables,
- as in csh. Use the assignment operator ('=') for
- that.
-
- The -t option causes the set command to use the
- top level symbol table to find definitions. This
- is useful with the shared SKsh modes.
-
- Example: set -b '[a-d]*'
-
- See Also: unset
-
- _________________________________________________________________
-
-
-
-
-
-
- SKsh Amiga Shell Page 125 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: setmap
-
- Type: Builtin
-
- Default: n/a
-
- Usage: setmap -r
- setmap -s map [{key|code} {fn|"@map"|"!macro"}]...
- setmap -n mapnum ...
- setmap -e exitmap mapnum ...
- setmap -m macronum [ fn | string ] ...
-
- Range: 32 definable key maps ( 0 to 31)
- 256 entries per key map
- 32 definable key macros ( 0 to 31 )
- 64 byte maximum key macro size
-
- About: The setmap command is used to define SKsh keyboard
- editing maps. SKsh is capable of emulating most
- popular editor styles to a reasonable degree. The
- UserMan.doc file discusses the theory of SKsh key
- maps in greater detail; this is just intended as a
- reference guide. Pleas read that section as well.
-
- "setmap -r" resets all keymaps and key macros to
- their default (dumb) state.
-
- "setmap" alone or with an optional -s flag is used
- to set keymaps. The first argument is integer be-
- tween 0 and 31 indicating the keymap to change.
- All subsequent arguments are grouped in pairs; the
- first of the pair is a character (such as "A") or
- an ascii code (such as 08). The second of the
- pair is one of:
-
- 1) a function name (such as "DEL"). In this
- case the function will be executed when the
- key is pressed.
-
- 2) another keymap number prefixed by '@'. In
- this case the new keymap will become the
- current keymap when the key is pressed.
-
- 3) a macro number prefixed by '!'. In this
- case the macro will be executed when the key
- is pressed.
-
- "setmap -n" sets the keymaps to be non-exiting
- keymaps. In other words, after a function is ex-
- ecuted in the current keymap it remains the cur-
- rent keymap.
-
-
-
- SKsh Amiga Shell Page 126 Reference Manual
-
-
-
-
-
-
-
-
-
- "setmap -e" sets the keymaps to be "exiting"
- keymaps which exit to keymap "exitmap" after one
- function.
-
- "setmap -m" defines a numbered macro (macronum) to
- be a series of functions or strings.
-
-
- Notes: The following are legal keymap functions when used
- with "setmap -s" or "setmap -m"
-
- INS - insert typed character
- NOP - perform no operation
- ACC - "accept" and execute line
- REP - set repeat count
- FNK - execute function key
- BS - backspace
- BOL - move to beginning of line
- ZAP - delete all of current line
- DEL - delete one character forward
- EOL - move to end of line
- RHT - move cursor right one character
- LFT - move cursor left one character
- KEL - kill to end of the line
- UP - move to previous history line
- DN - move to next history line
- EXE - "execute" line and move to next
- FWW - move forward one word
- BKW - move backward one word
- BDW - backward delete word (before cursor)
- DLW - delete word (in front of cursor)
- SRH - search for text in history list
- CC1 - command completion type 1 (esc esc)
- CC2 - command completion type 2 (esc =)
- CC3 - command completion type 3 (esc *)
- HOL - head of list (first history line)
- TOL - tail of list (last history line)
- ILP - insert last parameter of previous line
- ILT - insert tail of previous line
- TIM - toggle insert mode
- RDL - redraw current line
- SPC - switch two previous characters
- ISM - change to insert mode (from any mode)
- OVS - change to overstrike mode
- PIO - change to previous insert/overstrike
- YNK - insert text from yank buffer
- CEL - copy text to EOL into yank buffer
- ERC - explicitly set repeat count
- GK0 - goto keymap 0 (for use in macros)
- GK1 - goto keymap 1 (for use in macros)
- GK2 - goto keymap 2 (for use in macros)
- GK3 - goto keymap 3 (for use in macros)
- GK4 - goto keymap 4 (for use in macros)
-
-
-
- SKsh Amiga Shell Page 127 Reference Manual
-
-
-
-
-
-
-
-
-
- Example: # reset all keymaps
- setmap -r
-
- # set keymaps 1 and 3 to be non-exiting
- setmap -n 1 3
-
- # set keymaps 2 and 4 to exit to keymap number 1
- setmap -e 1 2 4
-
- # set macro number 0 to move to the beginning of
- # the line, insert a '#', and accept the line
- setmap -m 0 BOL '#' ACC
-
- # set the "esc" key to move to keymap 1, the "del"
- # key to delete a character, and the "~" key to
- # execute macro number 5
- setmap -s 0 27 @1 04 DEL '~' '!5'
-
- See Also: UserMan.doc:
- Advanced Topics: Definable Keyboard Editing
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 128 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: SHARED_TYPE
-
- Type: Variable
-
- Default: n/a
-
- Usage: $SHARED_TYPE
-
- Range: n/a
-
- About: This variable contains the string 'master' or
- 'slave', depending on the master/slave status of
- this shell. See the UserMan.doc for details.
-
- Example:
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 129 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: SHELL
-
- Type: Variable
-
- Default: sksh
-
- Usage: $SHELL
-
- Range: n/a
-
- About: This variable is set by SKsh to the string "sksh".
- It can be used to test which shell is running,
- provided that the alternate shell has a similar
- syntax.
-
- Example: if [ "$SHELL" != 'sksh' ]
- then
- echo "This runs only under SKsh!"
- fi
-
- See Also: SYSNAME
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 130 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: shift
-
- Type: Builtin
-
- Default: n/a
-
- Usage: shift [ num ]
-
- Range: n/a
-
- About: This command is used inside of scripts or func-
- tions to shift the parametric arguments. For ex-
- ample, if $1 = 'foo' and $2 = 'bar', after a
- shift, $1 would be 'bar' and $2 would not be set.
- The '$#' and '$*' variables are also modified
- appropriately. If shift is given a numeric param-
- eter, it acts as though num consecutive shifts
- took place.
-
- Example: function my_func {
- echo "$2, $#"
- shift
- echo "$2, $#"
- }
-
- See Also: function
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 131 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: SIZE
-
- Type: Variable
-
- Default: "normal" for plain SKsh
- "tiny" for tiny_SKsh
-
- Usage: $SIZE
-
- Range: n/a
-
- About: This variable can be used to test the shell under which a
- script or function is being run.
-
- Example: if [ "$SIZE" = 'normal' ]
- then
- echo 'This is normal SKsh'
- else
- echo 'This is tiny_SKsh'
- fi
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 132 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: sleep
-
- Type: Builtin
-
- Default: n/a
-
- Usage: sleep n
-
- Range: n/a
-
- About: Sleep delays execution for n seconds. If n is
- omitted, zero, or negative, the command does not
- pause. Sleep takes virtually no CPU time. It
- will wake up once per second to check for the
- break key. Sleep is not guaranteed to be a delay
- of exactly n seconds; it may be more on a loaded
- system, or if SKsh is preempted by a higher prior-
- ity process. It is, however, guaranteed to be a
- delay of at least n seconds.
-
- Example: time sleep 5
-
- See Also: time
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 133 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: source
-
- Type: Builtin
-
- Default: n/a
-
- Usage: source [ file ... ]
-
- Range: n/a
-
- About: This command "sources" the named files; that is,
- they are executed, but not in a subshell, so that
- any variables, alias, etc, that they define are
- really defined in the parent's environment.
-
- A single dot ('.') may be used to source a file as
- well; this is compatible with ksh and sh.
-
- A file which is sourced does not have to have its
- script bit set (although it won't hurt). However,
- a script file which is to be executed by typing
- its name must have its script bit set.
-
- Executing a file is equivalent to:
-
- ( source file )
-
- Example: source my_init_file.sksh
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 134 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: stack
-
- Type: Function
-
- Default: n/a
-
- Usage: obsolete
-
- Range: n/a
-
- About: This function was obsoleted in SKsh 1.5. See the
- Addendum1.5.doc file for an explanation.
-
- Example:
-
- See Also: Addendum1.5.doc
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 135 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: SYSNAME
-
- Type: Variable
-
- Default: 'Amiga'
-
- Usage: $SYSNAME
-
- Range: n/a
-
- About: This variable describes the system on which SKsh
- is currently being run. There is currently only
- one version of SKsh, so this variable will contain
- "Amiga". If SKsh is ported to other systems, this
- variable can be used to determine the name of the
- system.
-
- Example: if [ "$SYSNAME" != 'Amiga' ]
- then
- echo "This script runs only on Amigas."
- fi
-
- See Also: SHELL
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 136 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: tackon
-
- Type: Builtin
-
- Default: n/a
-
- Usage: tackon [ -e ] [ fspec ] ...
-
- Range: n/a
-
- About: tackon assembles its arguments into a path name,
- inserting slashes where appropriate. For example,
- if the first argument is "ram:" and the second is
- "myfile", tackon will not insert a slash, as none
- is required. However, if the first argument had
- been "mydir", a slash would be inserted. None
- would be inserted for "mydir/" as it already con-
- tains a slash.
-
- If the -e option is given, any characters which
- need to be backslash escaped will be. These in-
- clude wildcard characters and whitespace. This is
- useful to create a filename which can be passed to
- the shell unquoted without invoking the wildcard
- expansion mechanism.
-
- Example: [prompt]: tackon ram: foo/bar/ not
- ram:foo/bar/not
- [prompt]: tackon -e 'ram:f*o' 'b ar'
- ram:f\*o/b\ ar
-
- See Also: echo
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 137 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: time
-
- Type: Keyword
-
- Default: n/a
-
- Usage: time statement
-
- Range: n/a
-
- About: time executes the statement and prints the execu-
- tion time in seconds.
-
- Example: time ( dir; sleep 2 )
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 138 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: tolower
-
- Type: Builtin
-
- Default: n/a
-
- Usage: tolower [ -nc ] [ parameter ... ]
-
- Range: n/a
-
- About: This command echos its arguments, converting all up-
- per case characters to lower case. The -n option
- will not append a newline, and the -c option will
- concatenate arguments, similar to echo.
-
- Example: tolower 'These' 'are ECHoEd' 'iN LowER caSE'
-
- See Also: toupper, capital, echo
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 139 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: touch
-
- Type: Builtin
-
- Default: n/a
-
- Usage: touch [ file ... ]
-
- Range: n/a
-
- About: touch create the named files if they do not exist,
- and in any case updates the file modification
- timestamp. It also resets the AmigaDos archive
- bit.
-
- Example: touch aaa bbb ccc
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 140 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: toupper
-
- Type: Builtin
-
- Default: n/a
-
- Usage: toupper [ -nc ] [ parameter ... ]
-
- Range: n/a
-
- About: This command echos its arguments, converting all
- lower case characters to upper case. The -n option
- will not append a newline, and the -c option will
- concatenate arguments, similar to echo.
-
- Example: toupper 'These' 'are ECHoEd' 'iN LowER caSE'
-
- See Also: tolower, capital, echo
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 141 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: true
-
- Type: Builtin
-
- Default: n/a
-
- Usage: true
-
- Range: n/a
-
- About: true simply returns a true exit code, and does
- nothing else.
-
- Example: while true
- do
- echo 'repeat forever!'
- sleep 1
- done
-
- See Also: false
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 142 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: unalias
-
- Type: Alias
-
- Default: unset -a
-
- Usage: unalias [ name ... ]
-
- Range: n/a
-
- About: This alias removes existing aliases from the cur-
- rent context. If no names are given, the command
- has no effect. Otherwise, each alias listed is
- removed, if it was in fact an alias.
-
- SKsh supplied aliases may be removed, but this is
- not recommended.
-
- Example: unalias my_alias my_other_alias
-
- See Also: unset
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 143 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: unfunc
-
- Type: Alias
-
- Default: unset -f
-
- Usage: unfunc [ name ... ]
-
- Range: n/a
-
- About: This alias removes existing functions from the
- current context. If no names are given, the com-
- mand has no effect. Otherwise, each function
- listed is removed, if it was in fact an function.
-
- SKsh supplied functions may be removed, but this
- is not recommended.
-
- Example: unfunc my_function my_other_function
-
- See Also: unset
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 144 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: unset
-
- Type: Builtin
-
- Default: n/a
-
- Usage: unset [ -favb ] [ name ... ]
-
- Range: n/a
-
- About: This command removes the definition of functions,
- aliases, variables, or builtins (controlled by the
- f, a, v, or b flags). If no flag is given, the
- default is to remove variable definitions.
-
- Unsetting a builtin (with the -b option) does not
- cause actual code to be removed from memory; it
- simply removes all internal references to that
- command, such that it appears to no longer exist.
- This can cause problems if not used carefully;
- only attempt this if you are sure you know what
- effects this will have. For example, if you re-
- move the 'exit' builtin, you will not be able to
- quit SKsh.
-
- Example: unset -f my_func1 my_func2
-
- See Also: unfunc, unalias
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 145 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: usage
-
- Type: Script
-
- Default: n/a
-
- Usage: usage [ script | binary | builtin ]...
-
- Range: n/a
-
- About: Usage executes each given command, passing it one
- parameter of '-?' to generate a usage message.
- The command can be any SKsh supplied script,
- binary, or builtin. If more than one parameter is
- given, each one is executed in turn.
-
- Example: usage history fgrep
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 146 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: variables
-
- Type: Alias
-
- Default: set -v
-
- Usage: variables [ -s ] [ pattern ... ]
-
- Range: n/a
-
- About: This alias lists defined variables. The pattern
- uses normal wildcards, but must be quoted to avoid
- being interpreted by the filename expansion
- mechanism. If the pattern is omitted, all vari-
- ables are listed except those beginning with an
- underscore character (hidden variables). For ex-
- ample, _ANSI_P1 is a hidden variable; if it was
- printed in the normal variable list, the display
- pen would be changed.
-
- Only variables for the current context are listed,
- so this command may have a different effect inside
- of a subshell or function than when typed
- manually.
-
- Example: variables -s '[A-H]*'
-
- See Also: set
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 147 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: version
-
- Type: Builtin
-
- Default: n/a
-
- Usage: version [ -ds ]
-
- Range: n/a
-
- About: version with no options prints the SKsh version
- string and copyright notice. The 'd' option ech-
- oes the compile date of SKsh, and the 's' option
- prints a single numeric value that will be
- incremented for each release of SKsh. This is
- useful in tests, as below.
-
- Example: if [ $(version -s) -lt 3 ]
- then
- echo 'This script requires a later SKsh
- version'
- fi
-
- See Also:
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 148 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: vi_mode
-
- Type: Script
-
- Default: n/a
-
- Usage: vi_mode
-
- Range: n/a
-
- About: vi_mode executes a series of setmap commands to
- implement a vi-like command line editing mode.
- This does not operate with Tiny_SKsh.
-
- Example: vi_mode # set vi command line editing.
-
- See Also: emacs_mode, setmap
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 149 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: whence
-
- Type: Builtin
-
- Default: n/a
-
- Usage: whence [ name ... ]
-
- Range: n/a
-
- About: whence reports how each name would be interpreted
- if it was used as a command. It will report
- whether the name will be interpreted as a builtin
- command, an alias, a function, or an external
- statement. If the command is interpreted as an
- external statement, a path to the command is
- printed.
-
- Example: whence whence if path ll
-
- See Also: which
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 150 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: which
-
- Type: Builtin
-
- Default: n/a
-
- Usage: which [ -s ] [ name ... ]
-
- Range: n/a
-
- About: which searches the current PATH variable for an
- occurrence of name. If it finds one, the path to
- name is printed. Multiple names are accepted, in
- which case the process is repeated for each one.
-
- If the '-s' option is set, which will terminate
- silently if the name is not found in the search
- path. Normally it prints a message to that
- effect.
-
- Although which does not know about aliases or
- functions as whence does, it is often more useful
- in scripts or from the command line. For example,
- if you know that "my_file" is in the search path,
- you can say:
-
- ll $(which -s my_file)
-
- to print information on my_file without knowing
- where it is. The example below is another pos-
- sible use. In the function, which is used both to
- avoid interpreting "run" recursively as a func-
- tion, and to find the desired binary. A better
- form of the 'run' function is included with the
- default '.skshinit' file.
-
- Example: function run {
- cmd="$1"
- shift
- $(which -s run) $(which $cmd) $*
- }
-
- See Also: whence
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 151 Reference Manual
-
-
-
-
-
-
-
-
-
- _________________________________________________________________
-
- Name: while/do/done
-
- Type: Keywords
-
- Default: n/a
-
- Usage: while expr do stmt_list done
-
- Range: n/a
-
- About: The statement list is executed while the expres-
- sion is true (returns a zero exit status).
-
- Example: a=1
- while [ $a -le 10 ]
- do
- echo "a = $a"
- done
-
- See Also: for
-
- _________________________________________________________________
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SKsh Amiga Shell Page 152 Reference Manual
-
-
-
-