-
Notifications
You must be signed in to change notification settings - Fork 0
What's New
Updated to use nerd font for better prompts
Using NotoSansM Nerd Font Mono Regular to get the fancy prompts;

curl -o gsh.appimage https://raw.githubusercontent.com/justlostintime/ppa/main/appimage/gsh-1.6.3-x86_64.AppImage
chmod 777 gsh.appimage
./gsh.appimage
To make gsh you default shell you still need to install one of the native packages from
curl -O https://raw.githubusercontent.com/justlostintime/ppa/main/{Your distro}/gsh[-_]1.6.3{distro naming}
curl -O https://raw.githubusercontent.com/justlostintime/ppa/main/debian/gsh_1.6.3-8_all.deb
curl -O https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/gsh_1.6.3-0ubuntu8_all.deb
With appimage version of the gsh it is not possible to make it your default shell.
curl -o gsh.appimage https://raw.githubusercontent.com/justlostintime/ppa/main/appimage/gsh-1.6.2-x86_64.AppImage
chmod 777 gsh.appimage
./gsh.appimage
To make gsh you default shell you still need to install one of the native packages from
curl -O https://raw.githubusercontent.com/justlostintime/ppa/main/{Your distro}/gsh[-_]1.6.2{distro naming}
See the root document for information on adding the PPA to your package source list.
No longer required SharedMem or gb.scripter be installed Many Bug fixes and updated Updated to support 3.19 release of gambas, Used older release if before this date or install gamabas from the gambas daily PPA
Fixed support for pipelines and tee fitting
Fixed Support for alias replacement, mult-statement lines
Added paths for, sub/class/struct search locations
Cleaned up a documented many functions
Improved stability, in daily use now for 2 years
Removed limit of 20 parameters in Aliases with parameters
add Support << for inline input
add Support <<< for inputting a string into a process
cleanup process management
bug fixes
Due to a bug fix in Gambas 3.17, a bug was introduced into gsh < 1.3.106. The WAIT implementation was changed in Gambas 3.17 and above Requiring a fix to gsh. Ensure gsh 1.3.106 or above in installed before moving to Gambas 3.17 or above, if possible.
If you find that your alias substitution has stopped working and if you are using the latest PPA: gambas daily, there was a change in gambas3 as to how objects are written to memory, which seems to making the alias process fail. So to fix this you need to make sure that /dev/shm/ is empty and then ~/vars/gsh.image is deleted. The image contains the environment and used the old object format.
Many Updates and improved stability!
Extended some cli shell functionality.
Extended the brace expansion, such that leading zero padding and bash 4 like 'step' may be added:
for each s as integer in $"0..1000..5"
Will enumerate from 0 to 1000 step 5.\
One point here is that cli lines containing filename or parameters with -+ etc embedded must be enclosed in quotes.
Updates to variable and function identifiers to correctly allow _ or $ as part of the name, be careful as a $ in front still
caused the use of shell variables.
Added function objdef which will return the text class/type name of an object of variable.
Cleaned up using a variable as a function, parameter passing using $0...$n
Calls now return string[] one entry for each line returned
$a = "for i as integer = 0 to 9\nprint i;;$0;;\nnext"
?? @a("This msg")
outputs:
1 This msg 2 This msg 3 This msg 4 This msg 5 This msg 6 This msg 7 This msg 8 This msg 9 This msg
Corrected how gsh detected new updates, correctly updates the base subs and classes of the gsh environment.
clearsubs and clearclass both now prompt for unsaved classes lcass, lsub both now display in same formatted way
It is now possible to include a linux command line into a gambas statement with the use of back ticks ` as a simple example:
if `ls -l | tr [a-z] [A-Z] > $a` = 0 then
print $a
else
echo the command failed
endif
Unlike bash, csh and sh, back ticks return the exit code of the last command executed.
google - search for info online and display results in the firefox browser
google "New Socks"
toclipboard - Copy a file to the clipboard, this used the xclip cli to do this, it must be installed. There is an alias tcb that can be used as a short form.
tcb Thisfile ' Copy this file to the clipboard
toclipboard ThisFile
fromclipboard - copy the clipboard to the standard out. Useful for directing the clipboard to other tasks. The is a shortform alias fcb.
!fcb > "thisfile" ' copy to a file
!fcb | tc [a-z] [A-Z] | less ' pass contents to a process
!fcb > $a ' To a global variable for use in a script
fromclipboard ' just print it to the terminal
browse - open the system default file browser at the current or specified directory
browse ' Opens the current directory with no wait
browse / ' Opens the browser at the root directory
Statement seperators have changed from : to :; as gambas now supports name spaces which use the : to separate namespace from contained variables.
{GambasVarName} - pass a gambas variable to the CLI
$GshVariableName - pass gambas shell variable to the CLI
defined as :
alias ifor()='for i as integer = 0 to &1:&2:next'
Used as:
ifor(20,'print "this is an alias use";;i:print i+1')
Max of 20 parameters are allowed
parameters may be enclosed in '..' for complex information and may contain other aliases
colon is recognized in alias as statement separators.
Lambda functions are defined starting with begin..end, lambda..end, {...}
Are used in scripts to create an executable code block.. see documentation
define as:
begin
dim a as string = "Test String"
print a
end
or with parameters:
begin(parm1)
dim a as string = "This Parm"¶m[0]
print a
end
Help now displays all of available help for gambas, gsh and plugins, first use is slow as it collects info
So a 'help str' will return:
NAME
Str$
String = Str$ ( Expression ) String = Str ( Expression )
Convert an expression into its printable string representation. It is the exact contrary of Val.
The current localization is used for converting numbers and dates.
Example
' Print on standard output or in a message
Public Const ON_STDOUT As Integer = 1
Public Const ON_MESSAGE As Integer = 2
Sub PrintOn(Where As Integer, What As Variant)
If Where = ON_STDOUT Then
Print What
Else If Where = ON_MESSAGE Then
Message(Str$(What))
Endif
End
See also
* Conversion_Functions
* Localization_and_Translation_Functions
* PRINT
passing gambas variables etc to cli is much more regular
sub clidemo
dim a as string = "this string"
echo a
echo {a}
echo {(a)}
echo {10*20}
echo 10*20
echo {(10*20)}
echo $"m{0..5}fil"
end
'now run it with:
clidemo
Outputs:
a
this string
this string
10*20
10*20
200
m0fil m1fil m2fil m3fil m4fil m5fil
for i as integer = 0 to 100
echo count {i} interates $"This{1..10}"
next
or
for each i as integer in $"0..100"
echo {i}
next
or
for each s as string in $"*/*"
print "File name";; s;; "found"
next
Gambas3 Linux Shell a Replacement for bash that uses Gambas syntax with extensions