Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-17-2008, 04:42 PM   #1
LQ Newbie
Registered: Sep 2008
Posts: 7

Rep: Reputation: 1
Question Single Command To Close Window and Return Exit Code

I am trying to figure out a command that isn't in a shell script that closes the shell session and returns the exit code that I specify.

something like:

sh exit (10 - 2 )
*opens a shell and then exits it , return an exit code of 8

is this possible? or am a forced to run a shell script to do this?

Thank You
Old 12-18-2008, 09:37 AM   #2
Senior Member
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Would this work/do what you want?

$ kill -s 8 pid_of_shell_session
Unfortunately, this requires you to make a system call in whichever language you are writing this in; while I have never seen the problems with system calls, some people consider it "poor programming practice" - which I can understand for portability issues, but normally, I would think that if you are asking a question like this, it is not intended for portability.

Last edited by indienick; 12-18-2008 at 09:40 AM.
Old 12-18-2008, 11:21 PM   #3
LQ Newbie
Registered: Dec 2008
Posts: 2

Rep: Reputation: 0
Can anyone help me out how to install wine in Reddhat 9 without a problem. Also advice where I can find the RPM for wine with all dependencies. Otherwise which Linux distribution is supportive for all these types of packages. I hope u understand the query and revert me ASAP.
Old 01-02-2009, 03:33 AM   #4
LQ Newbie
Registered: Jan 2009
Posts: 27

Rep: Reputation: 15
@ sirajuddin - Doesn't this qualify as thread hijacking?

Linux Archive

Last edited by dhanyaelizabeth; 01-10-2009 at 03:09 PM.


linux, script, shell

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit vs Return JimRobinson Linux - Newbie 3 07-24-2008 12:26 PM
How to close terminal window when launching app from command line Casket Linux - Newbie 8 11-02-2007 06:05 AM
Exit with Return nopcoder Programming 0 12-27-2005 10:03 AM
Command line screenshot of a single window Hko Programming 1 12-02-2005 09:21 AM
(how to close X Window) && (Dial up command) jax8 Linux - Newbie 2 02-14-2004 07:47 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration