LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 12-17-2008, 05:42 PM   #1
jagooch
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, 10:37 AM   #2
indienick
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?

Code:
$ 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 10:40 AM.
 
Old 12-19-2008, 12:21 AM   #3
sirajuddin
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, 04:33 AM   #4
dhanyaelizabeth
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 04:09 PM.
 
  


Reply

Tags
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 01:26 PM
How to close terminal window when launching app from command line Casket Linux - Newbie 8 11-02-2007 07:05 AM
Exit with Return nopcoder Programming 0 12-27-2005 11:03 AM
Command line screenshot of a single window Hko Programming 1 12-02-2005 10:21 AM
(how to close X Window) && (Dial up command) jax8 Linux - Newbie 2 02-14-2004 08:47 PM


All times are GMT -5. The time now is 10:23 PM.

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