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. python自动化测试学习笔记-5常用模块

    上一次学习了os模块,sys模块,json模块,random模块,string模块,time模块,hashlib模块,今天继续学习以下的常用模块: 1.datetime模块 2.pymysql模块(3 ...

  2. ACM_Cipher(异或运算)

    Cipher Time Limit: 2000/1000ms (Java/Others) Problem Description: 只剩两个小时就要正式开始第一次月赛了,大四师兄决定还是来出一道,找点 ...

  3. java学习笔记_BeatBox(GUI部分)

    import java.awt.*; import javax.swing.*; public class BeatBox { JFrame theFrame; JPanel mainPanel; S ...

  4. android学习之路资料集合

    版权声明:本文为 stormzhang 原创文章,可以随意转载,但必须在明确位置注明出处!!! 这篇博客背后的故事 一路走来很不容易,刚好知乎上被人邀请回答如何自学android编程, 就借这个机会在 ...

  5. JS——缓慢动画封装

    在知道如何获取内嵌式和外链式的标签属性值之后,我们再次封装缓慢动画: 单个属性 <!DOCTYPE html> <html> <head lang="en&qu ...

  6. The type new View.OnClickListener(){} must implement the inherited abstract method View.Onclicklis

    public class MainActivity extends Activity { protected Button startBrew = null; @Override protected ...

  7. CodeCombat代码全记录(Python学习利器)--Kithgard地牢代码1

    Kithgard地牢注意:在调用函数时,要在函数的后面加上括号内容,否则在python中,将不会认为你在调用这个函数内容,而你的英雄将像木头一样站在原地不会执行上左下右的移动!!! hero.move ...

  8. BZOJ 4561: [JLoi2016]圆的异或并 扫描线 + set

    看题解看了半天...... Code: #include<bits/stdc++.h> #define maxn 200010 #define ll long long using nam ...

  9. LDAP个人理解

    在新的公司办公,所有的后台系统或文档系统都公用一个LDAP账号. 接触到这个新名词,就查了一下,谈谈个人理解: LDAP是个协议, 简单地说,可以把LDAP服务理解为一套存放你账户密码的数据库系统.市 ...

  10. NOIWC2019 冬眠记

    冬眠 由于THUWC考太差了没啥心情做事…… Day -1 报到日前一天晚上去看了看宿舍表,发现周围全是集训队,隔壁就是栋爷.高队和lca,再隔壁是zzq和wxh……吓傻了(本校buff这么好吗) D ...