PublicShow sourceshell.pl -- Elementary shell commands

This library provides some basic (POSIX) shell commands defined in Prolog, such as pwd and ls for situations where there is no shell available or the shell output cannot be captured.

Source shell
Execute an interactive shell. The following options are tried to find a suitable shell command:
  1. The Prolog flag shell
  2. The environment variable $SHELL
  3. The Prolog flag posix_shell
  4. The environment variable %comspec% (Windows only)
Errors
- existence_error(config, shell) if no suitable shell can be found.
Source cd
Source cd(Dir)
Change working directory
Source pushd
Source pushd(+Dir)
Source popd
Source dirs
Manage the directory stack:
  • pushd/1 is as cd/1, pushing th old directory on a stack
  • pushd/0 swaps the current directory with the top of the stack
  • popd/0 pops to the top of the stack
  • dirs/0 lists the current directory and the stack.
Source pwd
Print current working directory
Source ls
Source ls(+Pattern)
Listing similar to Unix =ls -F=, flagging directories with =/=.
Source mv(+From, +To) is det
Move (Rename) a file. If To is a directory, From is moved into the directory. Uses expand_file_name/2 on the From argument.
Source rm(+File) is det
Remove (unlink) a file

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source cd(Arg1)
Source pushd(Arg1)
Source dirs
Source ls(Arg1)
Source popd