What is the use of command set -- and set - variable?


 
Thread Tools Search this Thread
Operating Systems HP-UX What is the use of command set -- and set - variable?
# 1  
Old 12-13-2010
What is the use of command set -- and set - variable?

Hi,

I am using hp unix

i want to know the use of the following commands

set --
set - variable

thanks
# 2  
Old 12-13-2010
HP-UX is an Operating System.
Code:
What version of HP-UX are you running?
uname -sr

Code:
What Shell are you using?
echo "${SHELL}"


The "set" command is described in the "man" page for your Shell.
If you have a modern HP-UX with the default Posix Shell see "man sh-posix".
# 3  
Old 12-13-2010
unix version HP-UX B.11.23
shell ==> sh
# 4  
Old 12-14-2010
this man sh-posix" has more details.. i need some example
# 5  
Old 01-11-2011
Code:
From "man sh-posix".
 
          -    Turn off -x and -v options and stop examining arguments for
                options.

           --   Do not change any of the options; useful in setting
                parameter 1 to a value beginning with -.  If no arguments
                follow this option, the positional parameters are unset.

Code:
Examples

set -x
# Script lines we want to debug
... lots of script lines ...
# Turn off debug
set -

# scriptname.sh
echo "Value is: $1"
set --
# Unset positional parameters $1 $2 etc.
echo "Value is: $1"

./scriptname,sh param1
Value is: param1
Value is:


Last edited by methyl; 01-11-2011 at 08:15 PM.. Reason: minor typos
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script set command to a variable

Hi, Will following set up work in bash script? I've got errors if assigning following binary command to a variable. But on the other hand, COMMAND="ls" works. Any explanation please? How can I assign binary command to a variable COMMAND then I can just call ${COMMAND}? COMMAND="rsync"... (3 Replies)
Discussion started by: hce
3 Replies

2. Shell Programming and Scripting

Set shell variable from command

shell script has a command inside back quotes in method update_TABLE I need to store the count of number of Rows updated and store it in shell script variable "num" num = 0; Update_TABLE Update_TABLE() { `echo " set verify off feedback off echo off pagesize 0 head off... (4 Replies)
Discussion started by: finder255
4 Replies

3. UNIX for Dummies Questions & Answers

How to set server's ip address, router, network mask and set if it is an internal or external ip?

Hello, I need to write a program which sets server's ip address, router, network mask. Program also should set if it is an internal or external ip. Maybe someone can help me ? Any information from u is very useful :b: I stopped at .. :( #!/bin/sh A=`hostname -i` echo "server ip address is $A"... (4 Replies)
Discussion started by: zagaruika
4 Replies

4. Shell Programming and Scripting

set variable to command output

I'm hoping you guys can help me out here. I've been trying different methods to try and get what IW as hoping would be a fairly simple script but has turned into a pain. Bit of background - I am writing a script to check values in certain failes to ensure they are corerct. I'm runnign this on... (2 Replies)
Discussion started by: stuc
2 Replies

5. Shell Programming and Scripting

How to set mutliple words variable from command line

I'm writing a script (C shell) to search for a pattern in file. For example scriptname pattern file1 file2 filenN I use for loop to loop through arguments argv, and it does the job if all arguments are supplied. However if only one argument is supplied (in that case pattern ) it should ask to... (5 Replies)
Discussion started by: patryk44
5 Replies

6. Shell Programming and Scripting

need sed command to read a path and set to variable

I have a variable called PATH that contains a path example: /Users/rtipton/Desktop/testusers/test I need a sed command to set a variable called USER to the last directory name in that path PATH="/Users/rtipton/Desktop/testusers/test" and from that PATH i need USER to = test I know sed... (4 Replies)
Discussion started by: tret
4 Replies

7. Shell Programming and Scripting

Set specific part in command output into variable

I am trying unsuccessfully to set into a variable a specific part of command output: The command output will be as: line 1: <varied> line 2: 2 options: option 1: Set view: ** NONE ** or option 2: Set view: <different_name_of_views_always_without_spaces> and I would like to get into... (7 Replies)
Discussion started by: orit
7 Replies

8. Shell Programming and Scripting

set variable command

Hi all, I want to set a variable in ksh shell (prompt) and echo the value. $ set x=5 $echo $x But it is returning null. Can any one please help. Thanks in advance (1 Reply)
Discussion started by: ammu
1 Replies

9. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies
Login or Register to Ask a Question