Friday, February 3, 2012

Script languages

Introduction: The script languages that have interpreters operating under Linux OS (eg Mepis, OpenSUSE, Mandriva, Ubuntu, PCLOS) and will be covered, here, in this section are: perl, python, tcl, tk, ruby, rexx (regina) and haskell. In order to prepare scripts in different languages and have them run in the terminal (konsole) window, it is suggested to first set up the appropriate icons and folders on the desktop as follows:
  1. Right click the mouse (i.e. click the right btton on your mouse), then choose Create new and then click folder from the subcontext menu that will appear on the screen.
  2. Enter the folder name, example My scripts. Double-click the folder you have just created and start adding the links to applications.
  3. Right-click your mouse, then choose Create new and click Link to application. In the dialogue box that will appear (under the general tab), type the name of the script language, eg. my perl scripts. Click the Application tab, then go to the Work path field, click on the icon to the left of the field then click on the folder having you scripts (in our example would be perl scripts). Then go to the command field and type konsole, then click the OK button in the dialogue (tab) box.
  4. Now you have an icon in the scripts file (on your desktop) for perl ones, you can have additional ones for python, tcl, ruby,...etc.
  5. When you click this icon a shell session will start in the scripts directory that you want, eg. perl. You can get a list of files in the directory (by typing dir or ls at the prompt), then you can start your perl scripts by typing perl followed by a space and the file name (having the script) with .pl extension. If you have the sha-bang in your script (this special first line is #!/usr/bin/perl), then you run your script with ./ and the file name with its extension (with no space between ./ and the file name). The same applies to the other scripting languages mentioned here.
To read more, click here.

1 comment: