Skip to content
Gambas Script edited this page Oct 27, 2021 · 44 revisions

Gambas Shell(gsh)

Whats new in latest release
Read Gambas Shell Documentation Click Here.

Getting Started Guide - step by step to gsh shell.

See Gambas Shell Examples Click here.
See Shell Code Here.
See SharedMem Code Here.

Gsh is a general purpose shell much like bash or sh which may be used for interactive terminal sessions or job control. The major difference being the use of complete Gambas3 Basic syntax with language extension to allow cli pipes and redirection when required.

One of it's extended features is the ability to share data between running processes and to store the state and environment between invocations. Interactively function can be created and tested individually. And later compiled into a single Gambas script.

Gsh required Gambas version >= 3.15.3 or daily build be installed as it’s base Gambas release.

Some of the differences are that redirection is to and from Global variable or functions as well as files. These variable work through an in memory database. Global variables may be loaded and saved to from files. The functions may open and feed data from a file for example.

The in memory database is utilized though out the shell to store persistent values and use the $varname notation through out scripts and interactive sessions. This is important to understand as gsh compiles and executes blocks of code as they are completed from the command line or read from a script file.

Code blocks are defined as any section of code containing Gambas syntax block as examples for-next, if-endif etc. To allow programs to be entered for one time use lambda-end notation has been added to the valid syntax.

The remainder of this document attempts to describe the Gambas shell interface and general usage.

The development of this shell started as a test program and fun project for the in memory database and sort of just grew. I enjoy using it now in the day to day operation at work and home.. enjoy!

Requirements

Gsh has the a few important requirements.

Gambas3 version 3.15.3 or greater.

Gambas3 and C libraries

Gambas3 libs:

  • gambas3-runtime >= 3.15.3
  • gambas3-scripter >= 3.15.3
  • gambas3-dev >= 3.15.3
  • gambas3-gb-signal >= 3.15.3
  • gambas3-gb-pcre >= 3.15.3
  • gambas3-gb-eval-highlight >= 3.15.3
  • gambas3-gb-args >= 3.15.3

C Libs:

libreadline7 or greater version depending on your OS. Version 5 will work but does not pass signals to the shell.
GNU readline and history libraries Libc6 or greater Libpthread-2.27 or greater sharedmem gambas component, included in the data section of gsh project files

An installable version of gsh and sharedmem are included the data section of project file

Optionally the fortune app. The onstart() default startup will try to run it….

# Installation

Add Repositories for ubuntu/debian based distros to install Gambas3 repository.

sudo add-apt-repository ppa:gambas-team/gambas-daily && apt-get update

Install shared memory library. These are available from this git repository. download and change to the directory containing the installation packages.

    sudo apt install ./gambas3-westwood-sharedmem_3.15.2-0ubuntu30_all.deb
  or
    dpkg --force-all -i gambas3-westwood-sharedmem_3.15.2-0ubuntu30_all.deb : if you need to force the install

Install Gambas shell gsh.

    sudo apt install ./gsh_1.3.1-0ubuntu18_all.deb(or what ever latest version is)
  or
    dpkg -- force-all -i gsh_1.1-0ubuntu18_all.deb : if you need to force the install

Making gsh your default shell:

    sudo vi /etc/shells
    add /usr/bin/gsh   at end of file
    save the file
    chsh  -s /usr/bin/gsh

Clone this wiki locally