Skip to content
Gambas Shell GSH edited this page Jan 23, 2022 · 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 Source Code Here.
See SharedMem Source 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 functions can be created and tested individually. And later compiled into a single Gambas script.

Gsh required Gambas version >= 3.16.3 or the 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 throughout the shell to store persistent values and use the $varname notation throughout 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 do ... done, begin..end or { ..} 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 an interactive test program. It has now developed enough that I use it as my daily driver.

Enjoy!

Requirements

Gsh has the a few important requirements.

Gambas3 version 3.16.3 or greater.

Gambas3 and C libraries

Gambas3 libs:

  • gambas3-runtime >= 3.16.3
  • gambas3-scripter >= 3.16.3
  • gambas3-dev >= 3.16.3
  • gambas3-gb-signal >= 3.16.3
  • gambas3-gb-pcre >= 3.16.3
  • gambas3-gb-eval-highlight >= 3.16.3
  • gambas3-gb-args >= 3.16.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
       sudo apt-get upgrade

Updated for version >= 1.3.50 new install procedure
from Gambas Shell Repository
download the installer for your distribution
install the installer for example:

       sudo apt install gambas3-dev-tools       (this is required as gbc is no longer installed by default
       sudo apt install ./gshinstall_1.0.44-1_all.deb(or which ever is latest version)
then once that is installed:
       sudo gshinstall
and follow directions.

Manual Install method

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. From Here Download SharedMem

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

From Here Download gb.scripter sudo apt install ./gambas3-gb.scripter-3.16.90.deb

Install Gambas shell gsh. From Here Download 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