-
Notifications
You must be signed in to change notification settings - Fork 0
Gambas Shell (gsh) — New User Overview
Gambas Shell (aka gsh) is a versatile command-line shell that operates similarly to Bash or sh, but it leverages Gambas 3 BASIC syntax along with extensions for pipelines and redirection. It’s designed for both interactive use and scripting, making experimentation and development more seamless and expressive.
-
Familiar syntax with added power Use complete Gambas-style code blocks (
for-next,if-endif,do…done, etc.) or single-line statements. It integrates shell functionality with structured scripting. -
Persistent, shared state Maintains an in-memory database of global variables ($var notation) and functions, which can be saved to disk and shared across sessions or processes.
-
Dynamic plugin loading gsh automatically searches and loads plugin modules (subs, classes, structs, scripts) dynamically from designated directories like
~/vars/...and/usr/share/gsh/..., in prioritized order (See file and directory overview). -
Seamless file and variable redirection You can redirect input/output to both files and global variables or functions, thanks to the persistent in-memory storage.
-
Extensible CLI operations Common shell tasks are simplified with built-in commands:
-
browse: open file manager -
google: perform a web search in your browser -
toclipboard(tcb): copy content to clipboard -
fromclipboard(fcb): retrieve clipboard content or store it to variables or files (lists.gambas-basic.org).
-
-
Gambas version Requires Gambas 3.18.4 or newer, including components like
gambas3-runtime,gambas3-dev-tools,gambas3-scripter,gambas3-gb.highlight,gambas3-gb-args, among others. -
Installation methods
-
AppImage (easiest): Download and run
gsh.appimage(e.g. version 1.6.2.13 as of June 23, 2024). -
Package installations: For Debian/Ubuntu and derivatives, add the PPA via
curl … KEY.gpgandgsh.list, then install withapt install gsh. - The older
gshinstallapproach is deprecated.
-
AppImage (easiest): Download and run
-
Make it your default shell Add
/usr/bin/gshto/etc/shells, then runchsh -s /usr/bin/gsh. Log out and log back in to apply . -
Profile and startup behavior
-
~/vars/profile.gshruns during installation and sets up aliases and environment defaults. -
~/.gshrcacts like.bashrc, executed at every startup. -
~/vars/subs/onstartand~/vars/subs/onexitare plugin scripts executing at session start and exit, respectively (e.g.onstartcan show a fortune message and set the prompt style) (See Overview of files).
-
-
Best practices
- Use
clearsubswhen upgrading across major versions to avoid residual in-memory functions, andsavesubsto back up your subs/scripts. - For unexpected behavior, delete
~/vars/gsh.imageand/dev/shm/gsh*to reset the shell state.
- Use
-
Explore examples Browse example scripts and usage samples via the wiki’s "Getting Started Guide" and "Examples" sections.
| Topic | Summary |
|---|---|
| Shell language | Gambas 3 BASIC + shell features |
| State management | Persistent variables/functions via in-memory DB |
| Dynamic modules | Auto-load of plugins and scripts |
| Requirements | Gambas 3.18.4+, necessary libs installed |
| Install options | AppImage or PPA; old installer deprecated |
| Setup | Profile templates, aliases, startup plugins |
| Workflow tips | Use clearsubs, savesubs, reset image when needed |
| Extras | Built-ins like browse, google, clipboard commands |
Gambas3 Linux Shell a Replacement for bash that uses Gambas syntax with extensions