Sponsored Content
Top Forums Shell Programming and Scripting Terminal is closing on exit in ksh Post 302393493 by vij_krr on Tuesday 9th of February 2010 02:25:56 AM
Old 02-09-2010
Java Terminal is closing on exit in ksh

hi

while executing the following script, my terminal window is getting closed if I enter a invalid option. I want the script should go back the the command prompt. how to do achive it. i execute the script as . ./test

Code:
#! /usr/bin/ksh

Printf " Type of Installer : \n\t\t 1. Whole Build \n\t\t 2. Partial Build "
printf " \n Enter the Option : "
read op
Option=0
if [ `echo "$op" | grep -c "[a-zA-Z]"` = "0" ]; then
    if [ "$op" -eq "1" ]; then
        Option=1
    elif  [ "$op" -eq "2" ]; then
        Option=2
    fi
fi

if [ "$Option" -eq "0" ]; then
    echo " Invalid Option "
    exit 255
fi

thanks in advance

Last edited by Scott; 02-09-2010 at 03:32 AM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. Programming

Exit Code in HP-UX KSH.

In one of my programs another process is called using the system command e.g. lv_error = system("myproc"); where lv_error is declared as an int. myproc would be returning 0 for success and 1 for failure. e.g. if (success) { return(0); }else{ return(1); } When the return code... (3 Replies)
Discussion started by: mbb
3 Replies

2. UNIX for Advanced & Expert Users

how to run a process after closing the terminal

i want to execute a shell script even if the terminal is closed. how to do? (3 Replies)
Discussion started by: lakshmananindia
3 Replies

3. UNIX for Advanced & Expert Users

How to exit the KSH functions

Hi I am having the script which contains more functions. I want to exit the function if any failure. I tried with exit - the session itself is getting logged out. How can i fix this issue? (11 Replies)
Discussion started by: sharif
11 Replies

4. Shell Programming and Scripting

Clear Terminal After Exit

I have had a look around and can not find the answer, I dont think im searching for the right phrase. I have written a script to control common functions on my server, however when exiting the script the terminal starts directly below the script that was running... how can i clear this so it... (2 Replies)
Discussion started by: foz
2 Replies

5. Shell Programming and Scripting

KSH: Test telnet and exit

Hi, I need to do a test Telnet in KSH and if the connection is good then disconnect the telnet session with out logging in and without exiting the shell script. Example output of a good connection: $telnet xxx.xx.xx.xxx xxxx Trying xxx.xx.xx.xxx... Connected to xxx.xx.xx.xxx. Escape... (1 Reply)
Discussion started by: calex
1 Replies

6. Shell Programming and Scripting

KSH: Confused with behaviour of exit

Hi Everyone, I am confused on why the below snippet of code is not working as I intend it to do. I have googled and confirmed that "exit" is supposed to abort the execution of the script regardless if the exit was called from inside a function, or the main body of the script. log_and_die() { ... (3 Replies)
Discussion started by: maddmaster
3 Replies

7. UNIX for Dummies Questions & Answers

Prevent terminal from closing after command execution

Hello, I want to create application which launches some terminal, then some command is executed on that terminal and then prevent terminal from closing. I started to do on gnome-terminal because the Gnome is the most widely used desktop-manager in the Linux distributions. I want to do... (3 Replies)
Discussion started by: tyanata
3 Replies

8. Debian

How to exit debian server terminal?

I have an situation that are quite strange to me. I am not able to exit the server terminal and enter back into my home computer terminal by the command exit like I used to be able to exit the server terminal with before. I end up into my root shell again without even typing the root password like... (6 Replies)
Discussion started by: Jonathan Sander
6 Replies

9. Shell Programming and Scripting

Script Works But Need It to Exit Upon Closing Program

Running Xubuntu 16.04 with shell version "GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)," I have a working script that consistently renames a Chrome window: #!/bin/sh while sleep 1; do xdotool search --name chrome 2>/dev/null | while read id; do xdotool set_window --name... (21 Replies)
Discussion started by: jakefish
21 Replies

10. Shell Programming and Scripting

Terminal running bash/rsync script does not close with exit (MacOS High SIerra)

Hello, I am running a bash script to do an rsync back on a computer running MacOS High Sierra. This is the script I am using, #!/bin/bash # main backup location, trailing slash included backup_loc="/Volumes/Archive_Volume/00_macos_backup/" # generic backup function function backup {... (12 Replies)
Discussion started by: LMHmedchem
12 Replies
Perl::Critic::Exception::Configuration::Option(3)	User Contributed Perl Documentation	 Perl::Critic::Exception::Configuration::Option(3)

NAME
Perl::Critic::Exception::Configuration::Option - A problem with an option in the Perl::Critic configuration. DESCRIPTION
A representation of a problem found with an option in the configuration of Perl::Critic, whether from a .perlcriticrc, another profile file, or command line. This is an abstract class. It should never be instantiated. INTERFACE SUPPORT
This is considered to be a public class. Any changes to its interface will go through a deprecation cycle. METHODS
"option_name()" The name of the option that was found to be in error. "option_value()" The value of the option that was found to be in error. "message_suffix()" Any text that should be applied to end of the standard message for this kind of exception. "message()" "error()" Overridden to call "full_message()". I.e. any message string in the superclass is ignored. "full_message()" Overridden to turn it into an abstract method to force subclasses to implement it. SEE ALSO
Perl::Critic::Exception::Configuration::Option::Global Perl::Critic::Exception::Configuration::Option::Policy AUTHOR
Elliot Shank <perl@galumph.com> COPYRIGHT
Copyright (c) 2007-2011 Elliot Shank. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.16.3 2014-06-09 Perl::Critic::Exception::Configuration::Option(3)
All times are GMT -4. The time now is 04:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy