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

**URL:** <https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054>\
**Category:** HP-UX\
**Created:** [December 13, 2010, 3:50am UTC](https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054 "2010-12-13T03:50:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gomathi](https://community.unix.com/letter_avatar/gomathi/32/5_5575768a8748004e209b776fc1b2916d.png) [@gomathi](https://community.unix.com/u/gomathi)\
**Post date:** [December 13, 2010, 3:50am UTC](https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054/1 "2010-12-13T03:50:19Z")

</div>

Hi,

I am using hp unix

i want to know the use of the following commands

set --  
set - variable

thanks

---

<div class="post-metadata">

**Author:** ![methyl](https://community.unix.com/letter_avatar/methyl/32/5_5575768a8748004e209b776fc1b2916d.png) [@methyl](https://community.unix.com/u/methyl)\
**Post date:** [December 13, 2010, 6:08am UTC](https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054/2 "2010-12-13T06:08:40Z")

</div>

HP-UX is an Operating System.

```nohighlight
What version of HP-UX are you running?
uname -sr

```

```nohighlight
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".

---

<div class="post-metadata">

**Author:** ![gomathi](https://community.unix.com/letter_avatar/gomathi/32/5_5575768a8748004e209b776fc1b2916d.png) [@gomathi](https://community.unix.com/u/gomathi)\
**Post date:** [December 13, 2010, 6:18am UTC](https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054/3 "2010-12-13T06:18:49Z")

</div>

unix version HP-UX B.11.23  
shell ==\> sh

---

<div class="post-metadata">

**Author:** ![gomathi](https://community.unix.com/letter_avatar/gomathi/32/5_5575768a8748004e209b776fc1b2916d.png) [@gomathi](https://community.unix.com/u/gomathi)\
**Post date:** [December 14, 2010, 8:29am UTC](https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054/4 "2010-12-14T08:29:04Z")

</div>

this man sh-posix" has more details.. i need some example

---

<div class="post-metadata">

**Author:** ![methyl](https://community.unix.com/letter_avatar/methyl/32/5_5575768a8748004e209b776fc1b2916d.png) [@methyl](https://community.unix.com/u/methyl)\
**Post date:** [January 11, 2011, 12:19pm UTC](https://community.unix.com/t/what-is-the-use-of-command-set-and-set-variable/279054/5 "2011-01-11T12:19:34Z")

</div>

```nohighlight
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.

```

```nohighlight

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: 

```
