Skip to content
Gambas Shell GSH edited this page Jun 23, 2024 · 42 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.
See PPA - Installation Packages.

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.18.0 or the Stable 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!

**UPDATE 06/23/2024

Release 1.6.2.13 is now available to try as an appimage, you can download it with the following command.

curl -o gsh.appimage https://raw.githubusercontent.com/justlostintime/ppa/main/appimage/gsh-1.6.2-x86_64.AppImage

UPDATE 12/26/2023

Release 1.6.2 uses gb.highlight and no longer requires sharedmem and gb.scripter components to be install separately. They are now integrated into the gsh app. The gsh app now required 3.19 or higher or the gambas daily build 3.18.90 for development until 3.19 is released.

Gambas3 libs:

  • gambas3-runtime >= 3.19 or 3.18.90 dev version from gambas daily ppa
  • gambas3-dev-tools >= 3.19
  • gambas3-scripter >= 3.19
  • gambas3-dev >= 3.19
  • gambas3-gb-signal >= 3.19
  • gambas3-gb-pcre >= 3.19
  • gambas3-gb-eval >= 3.19
  • gambas3-gb.highlight >= 3.19
  • gambas3-gb-args >= 3.19

UPDATE 12/9/2023

Release 1.5.3 is here and now requires at least 3.18 version of gambas runtime

UPDATE 07/23/2023

Gambas 3.18 is here and better than ever the latest version 1.4.3 it tailor made for the latest version of Gambas 3

UPDATE 06/29/2022

Gambas 3.17 is now available as a backport for debian and ubuntu, even available for Raspberry OS! Here is how to do this

for Raspberry Pi OS 64Bit Add this line to the beginning of /etc/apt/sources.list

deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free

Then for all versions of deb/pi/ubuntu
    sudo apt update
    apt -t bullseye-backports install gambas3

Update - Ubuntu/Debian/RaspberryPi OS binary installation packages available to add to apt source list

In the future this will be the preferred way of installing binary images. The gshInstall App will be depreciated.

sudo -i
curl -s --compressed "https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/KEY.gpg" | gpg --dearmor > /etc/apt/trusted.gpg.d/westwood-archive-key.gpg
sudo curl -s --compressed -o /etc/apt/sources.list.d/gsh.list "https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/gsh.list"
sudo apt update

Requirements

Gsh has the a few important requirements.

Gambas3 version 3.18.4 or greater.

Gambas3 and C libraries

Gambas3 libs:

  • gambas3-runtime >= 3.18.4
  • gambas3-dev-tools >= 3.18.4
  • gambas3-scripter >= 3.18.4
  • gambas3-dev >= 3.18.4
  • gambas3-gb-signal >= 3.18.4
  • gambas3-gb-pcre >= 3.18.4
  • gambas3-gb-eval >= 3.18.4
  • gambas3-gb.highlight >= 3.18.4
  • gambas3-gb-args >= 3.18.4

C Libs:

libreadline6 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 gambas3-westwood-sharedmem gambas component, see ppa gambas3-westwood-gb.scripter gambas component, see ppa

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/gambas3 && apt-get update
       sudo apt upgrade

Add the GSH ppa/package repository

sudo -i
curl -s --compressed "https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/KEY.gpg" | gpg --dearmor > /etc/apt/trusted.gpg.d/westwood-archive-key.gpg
sudo curl -s --compressed -o /etc/apt/sources.list.d/gsh.list "https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/gsh.list"
sudo apt update

sudo apt install gsh

NOTE: the following gshinstall method has been depreciated see the gsh ppa install

Updated for gsh versions >= 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.

Video installing onto Kubunto 20.04 Youtube video Install

Note : Manual Install method depreciated

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 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