-
Notifications
You must be signed in to change notification settings - Fork 0
What's New
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