clear out all variables without closing terminal

https://unix.stackexchange.com/questions/172655/clear-out-all-variables-without-closing-terminal

I want to know how to clear all variables which I defined in command prompt without closingterminal ?

for example, if I set a variable in command prompt as:

  1. $ a=1

now I want to delete the variable $a (and many other variables defined in similar way) without closing terminal. I could use unset but it will be hectic if there are large no. of variables

---------------------------

If you do

  1. exec bash

you will use a fresh & new environnement

--------------------------------------------------

https://stackoverflow.com/questions/15825353/bash-array-export

You can't export an array in Bash (or any other shell). Bash will never export an array to the environment (until maybe implemented someday, see the bugs section in the manpage).

There are a couple things going on here. Again, setting the -x attribute on an array is nonsensical because it won't actually be exported. The only reason you're seeing those results is because you defined the array before localizing it, causing it to drop down to the next-outermost scope in which that name has been made local (or the global scope).

So to be clear, whenever you use a declaration command, you're always creating a local except when you use export or readonly with a non-array assignment as an argument, because these are POSIX, which doesn't specify either locals or arrays.

clear out all variables without closing terminal的更多相关文章

  1. 串口通信编程向导 Serial Programming Guide for POSIX Operating Systems

    https://www.cmrr.umn.edu/~strupp/serial.html#CONTENTS Introduction Chapter 1, Basics of Serial Commu ...

  2. Applying vector median filter on RGB image based on matlab

    前言: 最近想看看矢量中值滤波(Vector median filter, VMF)在GRB图像上的滤波效果,意外的是找了一大圈却发现网上没有现成的code,所以通过matab亲自实现了一个,需要学习 ...

  3. ThreadPoolExecutor源码学习(2)-- 在thrift中的应用

    thrift作为一个从底到上除去业务逻辑代码,可以生成多种语言客户端以及服务器代码,涵盖了网络,IO,进程,线程管理的框架,着实庞大,不过它层次清晰,4层每层解决不同的问题,可以按需取用,相当方便. ...

  4. 基于Mono.Cecil的静态注入

    Aop注入有2种方式:动态注入和静态注入,其中动态注入有很多实现了 动态注入有几种方式: 利用Remoting的ContextBoundObject或MarshalByRefObject. 动态代理( ...

  5. Android & CM build basics

    [CM source code folders] bootable/Among other things, the source for ClockworkMod recovery is in her ...

  6. SQLServer temporary table and table variable

    Temporary tables are created in tempdb.  The name "temporary" is slightly misleading, for ...

  7. Octave入门

    Octave/Matlab Tutorial Octave/Matlab Tutorial Basic Operations 你现在已经掌握不少机器学习知识了 在这段视频中 我将教你一种编程语言 Oc ...

  8. matlab安装和入门

    下载iso镜像: ISO镜像下载地址链接: http://pan.baidu.com/s/1i31bu5J 密码: obo1 单独破解文件下载链接: http://pan.baidu.com/s/1c ...

  9. Android NDK开发指南---Application.mk文件和android.mk文件

    https://android.googlesource.com/platform/development/+/donut-release/ndk/docs/OVERVIEW.TXT https:// ...

随机推荐

  1. wcf 代理配置

    <?xml version="1.0" encoding="utf-8"?> <configuration>   <appSett ...

  2. $tsinsenA1067$

    \(problem\) 这种题目需要一个定理 \(a[1]+a[2]+a[3]+a[4]...=(a[1]%mod)+...\) 本人出奇的懒 然后 动态规划?(恰似枚举) #include < ...

  3. EasyUI系列学习(四)-Droppable(放置)

    一.创建组件 1.使用标签创建一个放置区 <div id="pox" class="easyui-droppable" style="width ...

  4. 商业计算中Java高精度计算BigDecimal类

    <Effective Java> 第48条:如果需要精确的答案,请避免使用float和double. 如果我们编译运行下面这个程序会看到什么?public class Test{    p ...

  5. PHP常用的一些函数:

    背景:这一次是对一些函数进行整理,方便以后的使用. 1.date(); date()函数的作用是获取当前日期时间,由于PHP 5.0对date()函数进行了重写,因此,当前的日期时间函数比系统时间少了 ...

  6. jsp之认识 servlet (基础、工作原理、容器请求处理)

    Tomcat 的安装: eclipse 需要自行安装tomcat,这是web 项目运行的服务器.如果用的是MyEclipse,里面自带tomcat,方便清除部署垃圾,利于项目运行. Tomcat的安装 ...

  7. android计算屏幕dp

    首先我们来了解一些基本元素: px:像素,屏幕上的点. dpi:一英寸长的直线上的像素点的数量,即像素密度.标准值是160dp. /*** 正是因为dpi值其代表的特性,所以android项目的资源文 ...

  8. crontab错误处理

    crontab任务跑着跑着突然停了,莫名奇妙,查看日志,发现以下错误: 网上搜了一下报错,提示说是调整打开最大进程数,设置如下

  9. CAD增加一个有形的线型(网页版)

    主要用到函数说明: _DMxDrawX::AddTextStyle1 向数据库中增加一个文字样式.详细说明如下: 参数 说明 BSTR pszName 文字样式名称 BSTR pszFileName ...

  10. Django View(视图系统)

    Django View 官方文档 一个视图函数(类),简称视图,是一个简单的 Python 函数(类),它接受Web请求并且返回Web响应.响应可以是一张网页的HTML内容,一个重定向,一个404错误 ...