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:

$ 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

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. HTML--文本输入框、密码输入框

    当用户要在表单中键入字母.数字等内容时,就会用到文本输入框.文本框也可以转化为密码输入框. 语法: <form> <input type="text/password&qu ...

  2. 阿里邮箱绑定Foxmail失败的解决办法

    收件服务器地址: POP 服务器地址:pop3.mxhichina.com 端口110,SSL 加密端口995 或 IMAP 服务器地址:imap.mxhichina.com 端口143,SSL 加密 ...

  3. Task.Run 和 Task.Factory.StartNew

    在.Net 4中,Task.Factory.StartNew是启动一个新Task的首选方法.它有很多重载方法,使它在具体使用当中可以非常灵活,通过设置可选参数,可以传递任意状态,取消任务继续执行,甚至 ...

  4. iOS device is locked/unlocked (判断手机屏幕是否锁屏)

    #import <notify.h> -(void)checkDeviceLockScreenState { int notify_token; notify_register_dispa ...

  5. UVM基础之----uvm_object

    uvm_void The uvm_void class is the base class for all UVM classes. uvm_object: The uvm_object class ...

  6. Jupyter(Ipython) Notebook 入门

    upyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本,支持运行 40 多种编程语言. 一般用来编写漂亮的交互式文档. 文学编程的读者不是机器,而是人. 我们 ...

  7. redis集群——RPLR简笔(Redis+PostgreSQL+Linux(centos7)+RabbitMQ)

    使用的是centos7. 1.下载最新redis源码,解压(2016-05-12最新版本为3.2.0,3.0及以上才有官方集群) 2.进入源码根目录(此目录下的redis-stable目录),找到ut ...

  8. html5——伸缩比例案例(携程)

    1.有图片的盒子,最好是父盒子设置伸缩属性,a标签设置伸缩比例1,img标签宽度100% 2.不要见到父盒子就设置伸缩属性,而是根据子盒子是否占据一行,若是子盒子占据一行,那么只要给子盒子设置伸缩比例 ...

  9. apk的包名修改

    今天,想在android手机上安装两个相同的应用,本以为可以安装不同版本的,试了几次,均相互覆盖了,于是,只能设法修改apk所对应的包名(package name). 目的声明:本文只是为了满足DIY ...

  10. vue里的tab控件

    如下图,v-model绑定的值,这个值在js里一旦改变,视图就会切换到相应的tab页,这意味着一定要先给tab页内容数据赋值,再改变这个tabsIndex的值 如下图,先赋值data列表数据,在更改t ...