tags:

views:

35

answers:

1

I am writing my first ever bash script, so excuse the noobie-ness.

It's called hello.bash, and this is what it contains:

#!/bin/bash
echo Hello World

I did

chmod 700 hello.bash

to give myself permissions to execute.

Now, when I type

exec hello.bash

My putty terminal instantly shuts down. What am I doing wrong?

+5  A: 

From the man page for exec:

If command is supplied, it replaces the shell without creating a new process. If no command is specified, redirections may be used to affect the current shell environment.

So your script process runs in place of your terminal and when it exits, so does your terminal. Just execute it instead:

./hello.bash
ars
thanks, your second command worked
xbonez