Start Process, Close Shell

When I log in through PuTTY to a shell, is there a way to run a program and close the shell at the same time, so that only the program is running and the shell process is not running in the background any more?
LVL 4
wertykAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
exec /whatever/you/please

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wertykAuthor Commented:
thanks gheist, it works perfectly.
MaRiOsGRCommented:
also try : nohup command

 :o)
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

wertykAuthor Commented:
how would i use nohup?
MaRiOsGRCommented:
type in the shell
nohup wget mpla mpla mpla

this will download the link no mater if you  close the putty client.

So put nohup and after the command you want.

it will also create a log file so you can read what happened.

wertykAuthor Commented:
huh? i think we have a misunderstanding. i dont want to download something. what i want is this:

i run putty and log in
i run a program and close the shell at the same time <this is what i'm asking how to do here>
i use the program (putty is still open at this time)
when i exit the program, putty closes and does not go back to the shell.

here is what happens normally:

<open putty and log in>
> myprogram
<myprogram runs>
welcome to myprogram, please type quit to exit
: quit
thank you for using myprogram.
<myprogram goes back to shell>
> exit
<shell quits and putty closes>

here's what i want to happen:

<open putty and log in>
> myprogram         <this is where i need to know the command>
welcome to myprogram, please type quit to exit
: quit
thank you for using myprogram
<myprogram quits and putty closes>

using gheist's exec command does this just fine. thanks for your help, though. if you know another way to do this, please let me know.
MaRiOsGRCommented:
oh ok im sorry i understand something else.

U can u se nohup to run any command u want,  and it will not be stoped even if you get disconnected.
run : man nohup  
to see what i mean.

Take care :)
wertykAuthor Commented:
oh ok, i see. thanks, that will come in handy.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.