KSH : Disable -x option


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting KSH : Disable -x option
# 1  
Old 10-20-2005
KSH : Disable -x option

I have a KSH script. I want NO-ONE to call it with -x option.

example : ksh -x /appl/u001/test_it_out.ksh

Is there a way to know, from with in script, that they invoked the script with -x option. So that I can exit when they invoke it with -x option.

please help.
# 2  
Old 10-20-2005
Yes....

Code:
$ cat vangaru.ksh
#! /bin/ksh

case $- in
  *x*) echo "Invoked with -x" && exit 1
         ;;
esac

echo "Is okay...."

exit 0
$ ksh ./vangaru.ksh
Is okay....
$ ksh -x ./vangaru.ksh
+ echo Invoked with -x
Invoked with -x
+ exit 1

Cheers
ZB
# 3  
Old 10-20-2005
Or you could use "set +x" as your first statement. Bear in mind that anyone who can execute the script can read it. So they can copy it and remove this code, then run the copy.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh - default value for getopts option's argument

Hello everyone, I need help in understanding the default value for getopts option's argument in ksh. I've written a short test script: #!/bin/ksh usage(){ printf "Usage: -v and -m are mandatory\n\n" } while getopts ":v#m:" opt; do case $opt in v) version="$OPTARG";; ... (1 Reply)
Discussion started by: da1
1 Replies

2. Shell Programming and Scripting

ksh "getopts" -- Unsetting an Option

I use the "getopts" ksh built-in to handle command-line options, and I'm looking for a clean/standard way to "unset" an option on the command line. I don't know if this is a technical question about getopts or more of a style/standards question. Anyway, I understand that getopts processes its... (4 Replies)
Discussion started by: Matt Miller
4 Replies

3. Shell Programming and Scripting

[Solved] adding email option to KSH

Hi, I wanted to add a email option to this script. and was wondering if anyone could help me out. #!/bin/ksh echo "Finding hdisk" <DIR>/find-disk i=1 b=0 p=0 while ... (2 Replies)
Discussion started by: vpundit
2 Replies

4. Shell Programming and Scripting

KSH- perform a function if user selects option from menu

Hi, I have a script that copies a file from one directory to another and compiles it. What I have now is a menu that calls functions and each function compiles the file. I want to have a function that compiles the file at the end of the script if the user selects options 1-3 in the menu, but... (0 Replies)
Discussion started by: amitlib
0 Replies

5. Solaris

Disable multithreading option on T5240

Hi Gurus Can any one tell me the process of disabling the multithreading option on T5240 server and my OS is on LDOM, having one physical processor with 8 core & 8 thread per core Regards (3 Replies)
Discussion started by: amity
3 Replies

6. Red Hat

SSL/TLS renegotiation DoS -how to disable? Is it advisable to disable?

Hi all Expertise, I have following issue to solve, SSL / TLS Renegotiation DoS (low) 222.225.12.13 Ease of Exploitation Moderate Port 443/tcp Family Miscellaneous Following is the problem description:------------------ Description The remote service encrypts traffic using TLS / SSL and... (2 Replies)
Discussion started by: manalisharmabe
2 Replies

7. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

8. Shell Programming and Scripting

How to disable Enable/Disable Tab Key

Hi All, I have bash script, so what is sintax script in bash for Enable and Disable Tab Key. Thanks for your help.:( Thanks, Rico (1 Reply)
Discussion started by: carnegiex
1 Replies

9. Shell Programming and Scripting

"#!/bin/ksh -f" What does the -f option do?

What does "-f" option do? This is at the start of a shell scripts to point to full path to the interpreter such as /bin/ksh What does the -f option do? #!/bin/ksh -f (3 Replies)
Discussion started by: Arsenalman
3 Replies
Login or Register to Ask a Question