View Full Version : [SOLVED] Bash Script Problem

May 23rd, 2010, 09:27 PM
when i execute a hello world bash file, terminal appears and disappears, nothing else happens.
what to do now in order to see the resulted "hello world" text?

May 23rd, 2010, 09:28 PM
Show us the code you are using for this script.

da burger
May 23rd, 2010, 09:32 PM
If a terminal is opened by a launcher it closes again when the program finishes. Try running the command from with a terminal.

May 23rd, 2010, 10:42 PM
Add the following to the end of your script:

read x

This will force the code to wait for you to hit enter - so if this is being shown in a popup terminal, that terminal will have to wait for you.

X is nothing important - its the 'read' thats doing the work

May 23rd, 2010, 10:44 PM
Open the terminal, go to "Edit >> Profile Preferences >> Title and Command >> "When command exits" and set it to "Hold the terminal open".

You could also add a command to the end of script to keep it open, but I'm trying to figure out which command would do that myself.

Edit: the command is on previous post :)

May 23rd, 2010, 11:28 PM
Here's a good (http://gd.tuwien.ac.at/linuxcommand.org/writing_shell_scripts.php) (and easy to follow) tutorial on bash script writing. Hope it helps.

May 24th, 2010, 04:55 PM
Show us the code you are using for this script.

#! /bin/bash
echo "Hello World!"

May 24th, 2010, 04:56 PM
thanks guys problem solved.