Main Menu

friends

Banner

Latest articles

Install PHP for Apache (Fedora 12)
31/03/2010 | mad mad mod

This article describes how to install PHP for Apache on Linux (Fedora 12).
 Step 1: Install PHP  run the following command as root:

# yum install php


 Setting up Install Process
Resolving Depende [ ... ]


Hello World in BASH
01/11/2009 | mad mad mod

This article describes how to write and execute a "Hello World" bash script on Linux (Fedora).  1. the prerequisitesa text editor of your choice (e.g. vi)the bash shell
make sure you have installe [ ... ]


Other Articles
Facebook MySpace Twitter Digg Delicious Stumbleupon Google Bookmarks 

Designed by:
SiteGround web hosting Joomla Templates
hello world in tcl - radically simple E-mail
programming

This article describes how to write and execute a "Hello World" tclsh script on Linux (Fedora).

 

1. the prerequisites

  • a text editor of your choice (e.g. vi)
  • tclsh - Simple shell containing Tcl interpreter

make sure you have installed the bash shell:

# [root@fedora12 Desktop]# rpm -q tcl
tcl-8.5.7-4.fc12.i686

 

If it is not installed yet, you can install it with yum (you need to be root to do that):

# yum install tcl

 

 

2. write the code


open an empty file with a text editor (e.g. vi):


# vi helloworld.sh



now write the following lines into it:


#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

puts "Hello World!"



save the file and exit vi with ":wq + enter"

 

explanation


#!/bin/sh

This tells the system to use the /bin/sh interpreter to execute the script. You can find out the full path of your sh interpreter by entering the following command:


# which sh

/bin/sh




# the next line restarts using tclsh \

exec tclsh "$0" "$@"

 

from the man page:

"The exec statement cause the  shell  to  stop processing  and  instead  to  start  up  tclsh  to reprocess the entire script.  When tclsh starts up, it treats all three lines  as  comments, since the backslash at the end of the second line causes the third line to be treated as part of the comment on the second line."

 


puts "Hello World!"

{/chilicode}

 

prints the string "Hello World!"

 


3. make the script executable



# chmod u+x helloworld.sh




4. run the program


you can now execute the script program with:


# ./helloworld.sh

Hello World!

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

 
mad mad mod, Powered by Joomla! and designed by SiteGround web hosting