Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

unset(n) [opendarwin man page]

unset(n)						       Tcl Built-In Commands							  unset(n)

__________________________________________________________________________________________________________________________________________________

NAME
unset - Delete variables SYNOPSIS
unset ?-nocomplain? ?--? ?name name name ...? _________________________________________________________________ DESCRIPTION
This command removes one or more variables. Each name is a variable name, specified in any of the ways acceptable to the set command. If a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an array name with no parenthesized index, then the entire array is deleted. The unset command returns an empty string as result. If -nocom- | plain is specified as the first argument, any possible errors are suppressed. The option may not be abbreviated, in order to disambiguate | it from possible variable names. The option -- indicates the end of the options, and should be used if you wish to remove a variable with | the same name as any of the options. If an error occurs, any variables after the named one causing the error not deleted. An error can occur when the named variable doesn't exist, or the name refers to an array element but the variable is a scalar, or the name refers to a variable in a non-existent namespace. SEE ALSO
set(n), trace(n) KEYWORDS
remove, variable Tcl 8.4 unset(n)

Check Out this Related Man Page

unset(n)						       Tcl Built-In Commands							  unset(n)

__________________________________________________________________________________________________________________________________________________

NAME
unset - Delete variables SYNOPSIS
unset ?-nocomplain? ?--? ?name name name ...? _________________________________________________________________ DESCRIPTION
This command removes one or more variables. Each name is a variable name, specified in any of the ways acceptable to the set command. If a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an array name with no parenthesized index, then the entire array is deleted. The unset command returns an empty string as result. If -nocom- plain is specified as the first argument, any possible errors are suppressed. The option may not be abbreviated, in order to disambiguate it from possible variable names. The option -- indicates the end of the options, and should be used if you wish to remove a variable with the same name as any of the options. If an error occurs, any variables after the named one causing the error are not deleted. An error can occur when the named variable does not exist, or the name refers to an array element but the variable is a scalar, or the name refers to a variable in a non-existent namespace. EXAMPLE
Create an array containing a mapping from some numbers to their squares and remove the array elements for non-prime numbers: array set squares { 1 1 6 36 2 4 7 49 3 9 8 64 4 16 9 81 5 25 10 100 } puts "The squares are:" parray squares unset squares(1) squares(4) squares(6) unset squares(8) squares(9) squares(10) puts "The prime squares are:" parray squares SEE ALSO
set(n), trace(n), upvar(n) KEYWORDS
remove, variable Tcl 8.4 unset(n)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

unsetting (set -C) and set -o noclobber

I use a lot of text edditing on my laptop, and about a year and half ago I read my first unix bootk which gave the noclobber command and how to unset it.. now that my files are some what overflowing I need to use noclobber or the set -C option... I know the >| to override the no overwite command... (2 Replies)
Discussion started by: moxxx68
2 Replies

2. Shell Programming and Scripting

How to unset 'finger' info?

Hi, Command "chfn" can be used to change finger information.. can anybody tell me how to unset i mean reset the same finger information. Thanks in advance, Chanakya (3 Replies)
Discussion started by: Chanakya.m
3 Replies

3. UNIX for Advanced & Expert Users

how to unset the readonly variable

Hi All, May be this is a very simple question... $ b=8 $ readonly b $ echo $b 8 $ b=90 -bash: b: readonly variable $ unset b -bash: unset: b: cannot unset: readonly variable I m not able to change the readonly mode of variable b Please help me out.. Thanks Nidhi (2 Replies)
Discussion started by: Nidhi2177
2 Replies

4. Shell Programming and Scripting

unsetting OPTINT in getopts

i am calling a function multiple time which uses getopts to parse function arguments. WHile running, i am getting a bad shift error. i read somewhere that we have to reset the OPTIND variable after each getopts call. how do we do it? using unset OPTIND doesn't help:( (2 Replies)
Discussion started by: vickylife
2 Replies

5. Shell Programming and Scripting

Using unset to delete array elements

Hi, I am writing a BASH script. My questions regard deleting elements of arrays. I have an array: michael-browns-powerbook-g4-15:~ msb65$ test_array=(1 2 3 4) michael-browns-powerbook-g4-15:~ msb65$ echo ${test_array} 1 2 3 4 To delete the second element of test_array I type:... (3 Replies)
Discussion started by: msb65
3 Replies

6. Shell Programming and Scripting

How do I define a particular dir in PATH variable and then unset that dir

How do I define a particular dir in front of PATH variable and then run some job and then at the end of job SET the PATH variable to original? in a script, WILL something like this work: ORIG_PATH=$PATH export PATH=/dir1/dir2:$PATH RUN SOME JOBS ..... unset PATH EXPORT... (2 Replies)
Discussion started by: Hangman2
2 Replies

7. Shell Programming and Scripting

How to unset all variables in shell?

can I use unset to unset all the variables in a shell sciprt? VAR1=1 VAR2=2 VAR3=3 unset whether this unset will afftect any system variables? Thanks, (3 Replies)
Discussion started by: balamv
3 Replies

8. Shell Programming and Scripting

HELP unsetting array element in loop

I have a loop and I need to be able to unset the array element that I am currently accessing in it. I was thinking of making a counter that increments with the loop and doing unset $dirs but if I do that I am not sure if the other members of the array would get shifted down in index (meaning that... (2 Replies)
Discussion started by: msf5042
2 Replies

9. What is on Your Mind?

Sunsetting Superdomes ??

Is the HP superdome being sunsetted ? Hearing rumblings to that effect. Thanks. (3 Replies)
Discussion started by: Bill L.
3 Replies

10. UNIX for Advanced & Expert Users

unset .bashrc

Could someone please tell me how to unset your .bashrc? I have tried all of these. I can't find anything useful from google. unset -f .bashrc unset .bashrc (9 Replies)
Discussion started by: cokedude
9 Replies

11. Shell Programming and Scripting

How to trap set -o nounset in bash

I have a bash script using "set -o nounset" to prevent unset variables. However I have created a trap to run some cleanup options upon exit of the script which works fine for CTRL-C, etc. but if it hits and unset variable the trap does not run and the script bails out without having tidied up... (3 Replies)
Discussion started by: jelloir
3 Replies

12. 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

13. Shell Programming and Scripting

Listing all local variables for unset

I have tried to thoroughly search other threads before posting this question... I have a shell script (bsh) that I'd like to "re-execute" if the user chooses to. Before the program is executed again the local variables (those set within the script) need to be unset. Is there a command that... (6 Replies)
Discussion started by: powwm
6 Replies

14. UNIX for Dummies Questions & Answers

Where unset command locates?

Hi, Can someone tell what is the path for "unset", I tried "which" command but getting below error # which unset /usr/bin/which: no unset in (/usr/lib/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin/:/root/bin) (9 Replies)
Discussion started by: stew
9 Replies

15. UNIX for Beginners Questions & Answers

Unset array element and save to file in Bash

#!/bin/bash X=(2H 4S 10D QC JD 9H 8S) How do I unset the 10D from this array and save it to a file? Please use CODE tags as required by forum rules! (5 Replies)
Discussion started by: cogiz
5 Replies