SliTaz GNU/Linux official and community documentation wiki.
.png

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:handbook:development [2010/02/25 22:41]
linea
en:handbook:development [2010/08/17 21:36]
linea
Line 11: Line 11:
 === Create a SHell script === === Create a SHell script ===
  
-Before starting a new SHell script, you must pay attention to the interpreter used. Most SHell scripts use ///​bin/​sh//,​ because it's more portable, but there are scripts that rely on ///​bin/​bash//​ and this must be installed on the system. For a SHell script to functionit must be made executable by changing permissions on the command line using the chmod tool. To create a script.sh and make it executable:+Before starting a new SHell script, you must pay attention to the interpreter used. Most SHell scripts use ///​bin/​sh//,​ because it's more portable, but there are scripts that rely on ///​bin/​bash//​ and this must be installed on the system. For a SHell script to function it must be made executable by changing permissions on the command line using the chmod tool. To create a script.sh and make it executable:
  
 <​code>​ $ touch script.sh <​code>​ $ touch script.sh
Line 27: Line 27:
 Here's a script that contains a variable NAME and displays the value with the echo command: Here's a script that contains a variable NAME and displays the value with the echo command:
  
-<code>+<file>
 #!/bin/sh #!/bin/sh
  
Line 33: Line 33:
  
 echo "$NAME is nice." echo "$NAME is nice."
-</code>+</file>
  
 Once you have created/​modified your script.sh, you can execute it to see the result: Once you have created/​modified your script.sh, you can execute it to see the result:
Line 48: Line 48:
    ​--msgbox "​Message made by dialog."​ 5 54 </​code>​    ​--msgbox "​Message made by dialog."​ 5 54 </​code>​
  
-You can find plenty of example scripts in the ///sample// directory inside the source code of dialogwhich can be downloaded from: http://​invisible-island.net/​dialog/​dialog.html. Download sources and decompress:+You can find plenty of example scripts in the ///sample// directory inside the source code of dialog which can be downloaded from: http://​invisible-island.net/​dialog/​dialog.html. Download sources and decompress:
  
 <​code>​ $ wget ftp://​invisible-island.net/​dialog/​dialog.tar.gz <​code>​ $ wget ftp://​invisible-island.net/​dialog/​dialog.tar.gz
Line 68: Line 68:
 ===== Perl or Microperl - Code/use Perl scripts ===== ===== Perl or Microperl - Code/use Perl scripts =====
  
-On SliTaz you can use the powerful scripting language Perl via the perl or microperl binary. Microperl is a streamlined version of perl compiled from official sources, Perl scripts running Microperl are compatible with the complete version of Perl. One of Perl's strengths is its portability,​ it can be used on any system and it's an interpreted language, which means that the code doesn'​t need to be compiled and can be used directly. On SliTaz, Perl and Microperl are not installed by default on the LiveCD: you can either rebuild your ISO or install through the package manager. Note: Microperl is only 1 MB and provides no modules:+On SliTaz you can use the powerful scripting language Perl via the perl or microperl binary. Microperl is a streamlined version of perl compiled from official sources, Perl scripts running Microperl are compatible with the complete version of Perl. One of Perl's strengths is its portability,​ it can be used on any system and it's an interpreted language, which means that the code doesn'​t need to be compiled and can be used directly. On SliTaz, Perl and Microperl are not installed by default on the LiveCD: you can either rebuild your ISO or install through the package manager. Note: Microperl is only 1 MB and provides no modules:
  
 <​code>​ <​code>​
Line 88: Line 88:
 The first line of a Perl script begins by defining the path to the Perl interpreter,​ usually ///​usr/​bin/​perl//​ and to display text, just use the print command. It should be noted that Perl is case sensitive and a line of code should always end with a semicolon. Example code (you can copy and paste): The first line of a Perl script begins by defining the path to the Perl interpreter,​ usually ///​usr/​bin/​perl//​ and to display text, just use the print command. It should be noted that Perl is case sensitive and a line of code should always end with a semicolon. Example code (you can copy and paste):
  
-<code>+<file>
 #​!/​usr/​bin/​perl #​!/​usr/​bin/​perl
 # #
Line 94: Line 94:
 print "Hello World!\n";​ print "Hello World!\n";​
  
-</code>+</file>
 To execute and test the script: To execute and test the script:
  
Line 103: Line 103:
 CGI scripts are designed to display dynamically generated web pages. The Perl language associated with the LightTPD web server allows you to use CGI scripts through your public space or via virtual hosts. Perl is quite adapted to Web 2.0 and can generate xHTML pages. On SliTaz you must have Perl or Microperl installed and the LightTPD server configured before you can use CGI scripts coded in Perl. Note that by default SHell scripts (.sh) can be placed in /cgi-bin/. CGI scripts are designed to display dynamically generated web pages. The Perl language associated with the LightTPD web server allows you to use CGI scripts through your public space or via virtual hosts. Perl is quite adapted to Web 2.0 and can generate xHTML pages. On SliTaz you must have Perl or Microperl installed and the LightTPD server configured before you can use CGI scripts coded in Perl. Note that by default SHell scripts (.sh) can be placed in /cgi-bin/.
  
-Once the server is properly configured, you can put your CGI in your //​$HOME/​Public/​cgi-bin//​ using the //.pl// or //.cgi// extension and view them locally or remotely. Example of using a Perl CGI script:+Once the server is properly configured, you can put your CGI in your //​$HOME/​Public/​cgi-bin//​ using the //.pl// or //.cgi// extension and view them either ​locally or remotely. Example of using a Perl CGI script:
  
-<code>+<file>
 #​!/​usr/​bin/​perl #​!/​usr/​bin/​perl
 # #
Line 111: Line 111:
  
 print "Hello World!\n";​ print "Hello World!\n";​
-</code>+</file>
  
 ===== Python ===== ===== Python =====
Line 127: Line 127:
 ===== Toolchain - Libraries, C compiler and tools ===== ===== Toolchain - Libraries, C compiler and tools =====
  
-To compile software from sources or your own code, you need at least the basic toolchain, comprising of Binutils, Glibc, C compiler, Kernel headers and the Make utility. Note that the toolchain is used by the SliTaz developers to compile the entire system from source. To install the meta package and all dependancies:+To compile software from sources or your own code, you need at least the basic toolchain, comprising of Binutils, Glibc, C compiler, Kernel headers and the Make utility. Note that the toolchain is used by the SliTaz developers to compile the entire system from source. To install the meta package and all dependencies:
  
 <​code>​ # tazpkg get-install slitaz-toolchain </​code>​ <​code>​ # tazpkg get-install slitaz-toolchain </​code>​
Line 135: Line 135:
 <​code>​ $ tazpkg search pkg-config </​code>​ <​code>​ $ tazpkg search pkg-config </​code>​
  
-If you would like to compile applications utilizing the Ncurses library, you must install the ncurses-dev package. Note the ncurses package also provides a variety of small programs such as tic or tack:+If you would like to compile applications utilizing the Ncurses library, you must install the ncurses-dev package. Note the ncurses package also provides a variety of small programs such as tic or tac:
  
 <​code>​ $ tazpkg search ncurses </​code>​ <​code>​ $ tazpkg search ncurses </​code>​
  
 
en/handbook/development.txt ยท Last modified: 2016/10/24 16:24 by hgt