Skip to content

Tips and Tricks

ScriptBuilder edited this page Jan 18, 2021 · 18 revisions

Tips And Tricks

Correcting Block after entering and error or Just changing block

Example:
begin
  dim a as string = "test string"
  for i as integer = 0 to a.leg
    print a[i];;
    next
  end

Now there is an obvious error above a.leg, You don't have to retype it
just enter:
edit
by it's self. From here you can edit/change this block. The block will be executed
as soon as you save and quit the editor. If you want to save this block permanently
just change the name during the save phase.

When you installed gsh, both a nanorc and vim/vi rc where installed
so the code should be highlighted.
to choose your editor set the $editor global variable
$$editor="/usr/bin/vi" 
or
$$editor="/bin/nano"
The default editor is nano, to make your choice permanent you need to add it to the
~/.gshrc file
By the way you can edit any, sub/class/struct/variable in gsh

What to do when things go south/gsh does unexplained things

If the shell acts strange, delete the ~/var/gsh.image and any /dev/shm/'username'gsh and /dev/shm/'username'col
you find. then restart gsh, for a clean restart. 
Use savesubs and saveclass commands often to save your work. Theses are only in the image until you save them to disk.
The system puts them into your local ~/vars/subs and ~vars/class ~/var/struct directories. They will be loaded from
here if not found in the image upon demand.
gsh operates on an in memory image, which is auto saved when you create a global variable, this includes vars/subs/class/structs.
this image is synced to the disk upon exit and reloaded upon start restoring your last session state.
So... It can get messed up.... the above deletes the image and in memory db used to store global variables.
example:
rm /dev/shm/mynamcol /dev/shm/mynamegsh ~/vars/gsh.image
quit nosave
The nosave prevents the image from being dumped to disk.
then restart gsh.

Clone this wiki locally