source /etc/profile  出现

bash:PROMPT-COMMAND: 只读变量

利用unset命令是无法删除只读变量的

如果你linux中没有gdb命令的话,下载一下

sudo yum install gdb

下载好之后

先按照下面的方法试验一下

# readonly test=1

# test=2

bash: test: 只读变量

# cat << EOF| gdb

> attach $$

> call unbind_variable("test")

> detach

> EOF

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7

Copyright (C) 2013 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. Type "show copying"

and "show warranty" for details.

This GDB was configured as "x86_64-redhat-linux-gnu".

For bug reporting instructions, please see:

.

(gdb) Attaching to process 12409

Reading symbols from /usr/bin/bash...Reading symbols from /usr/bin/bash...(no debugging symbols found)...done.

(no debugging symbols found)...done.

Reading symbols from /lib64/libtinfo.so.5...Reading symbols from /lib64/libtinfo.so.5...(no debugging symbols found)...done.

(no debugging symbols found)...done.

Loaded symbols for /lib64/libtinfo.so.5

Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.

Loaded symbols for /lib64/libdl.so.2

Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.

Loaded symbols for /lib64/libc.so.6

Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.

Loaded symbols for /lib64/ld-linux-x86-64.so.2

Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.

Loaded symbols for /lib64/libnss_files.so.2

0x00007fd4b11db17c in waitpid () from /lib64/libc.so.6

Missing separate debuginfos, use: debuginfo-install bash-4.2.46-30.el7.x86_64

(gdb) $1 = 0

(gdb) Detaching from program: /usr/bin/bash, process 12409

(gdb) quit

然后

test=3

发现没显示只读变量提示,说明已经改好了

那么现在修改PROMPT-COMMAND只读变量属性

# cat << EOF| gdb

> attach $$

> call unbind_variable("PROMPT-COMMAND")

> detach

> EOF

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7

Copyright (C) 2013 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. Type "show copying"

and "show warranty" for details.

This GDB was configured as "x86_64-redhat-linux-gnu".

For bug reporting instructions, please see:

.

(gdb) Attaching to process 12409

Reading symbols from /usr/bin/bash...Reading symbols from /usr/bin/bash...(no debugging symbols found)...done.

(no debugging symbols found)...done.

Reading symbols from /lib64/libtinfo.so.5...Reading symbols from /lib64/libtinfo.so.5...(no debugging symbols found)...done.

(no debugging symbols found)...done.

Loaded symbols for /lib64/libtinfo.so.5

Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.

Loaded symbols for /lib64/libdl.so.2

Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.

Loaded symbols for /lib64/libc.so.6

Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.

Loaded symbols for /lib64/ld-linux-x86-64.so.2

Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.

Loaded symbols for /lib64/libnss_files.so.2

0x00007fd4b11db17c in waitpid () from /lib64/libc.so.6

Missing separate debuginfos, use: debuginfo-install bash-4.2.46-30.el7.x86_64

(gdb) $1 = 0

(gdb) Detaching from program: /usr/bin/bash, process 12409

(gdb) quit

重新运行一下

source /etc/profile

成功

参考  https://blog.csdn.net/weixin_43634280/article/details/84348180

linux中怎么删除只读变量,【Linux】【问题集锦】如何删除shell只读变量相关推荐

  1. linux中_Linux基础知识(Linux系统、Linux中的链表)

    Linux系统简介 Linux系统的结构及特点 Linux系统的结构图如下图所示: 从上图可以看出,Linux是一个典型的宏内核(一体化内核)结构.硬件系统上面时硬件抽象层,在硬件抽象层上面时内核服务 ...

  2. 19. linux中权限详解,Linux权限位,读写执行权限真正含义,chmod详解

    linux中权限详解,Linux权限位,读写执行权限真正含义,chmod详解 文章目录 Linux权限位 读写执行 三种权限真正含义和作用 权限对文件的作用 权限对目录的作用 示例 chmod 使用数 ...

  3. linux中内部命令有哪些,linux内部命令有哪些

    linux中常见的内部命令有:1.exit命令,退出当前的shell:2.history命令,显示历史执行过的命令:3.cd命令,切换当前工作目录:4.source命令,重新执行刚修改的初始化文件:5 ...

  4. centos sudo不能运行_如何在 Linux 中配置 sudo 访问权限 | Linux 中国

    Linux 系统中 root 用户拥有 Linux 中全部控制权力.Linux 系统中 root 是拥有最高权力的用户,可以在系统中实施任意的行为.-- Magesh Maruthamuthu Lin ...

  5. linux取证教程,Linux中的取证(Forensics in Linux)

    Linux中的取证(Forensics in Linux) 数字调查的主要问题是通过加密或任何其他格式保护重要证据或数据. 基本示例是存储密码. 因此,有必要了解Linux操作系统在数字取证实施中的使 ...

  6. linux中sh+$0,浅谈linux中shell变量$#,$@,$0,$1,$2的含义解释

    摘抄自:ABS_GUIDE 下载地址:http://www.tldp.org/LDP/abs/abs-guide.pdf linux中shell变量$#,$@,$0,$1,$2的含义解释: 变量说明: ...

  7. linux中的改变bin级别,Linux常用命令

    关机命令:shutdown -h now / shutdown -r now / reboot 切换图形化界面:startx      切换到命令行:注销即可 添加用户:useradd xiaomin ...

  8. 学习linux中踩的坑,踩踩Linux命令中的那些坑

    expr的坑 expr 是用来对数值进行计算的命令,命令的前后参数需要用空格隔开 [root@localhost ~]# whatis expr expr (1) – evaluate express ...

  9. linux中which命令详解,Linux下which命令使用详解(转)

    我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索: which 查看可执行文件的位置. whereis 查看文件的位置. locate 配合数据库查看文件位置. f ...

  10. linux中mtd动态加载,Linux 2.6.11 下 MTD驱动情景实例分析

    最近几天为了熟悉linux的驱动开发,我选择了其MTD驱动做了一些研究.我能找到的文章中我觉得有些部分不够细致,所以我还是自己写了一部分分析,希望对别人也能有所帮助,也做为自己的一个备忘,.蓝色文字的 ...

最新文章

  1. 【笔记】mysql入门语句8条
  2. jboss部署出现jboss.naming.context.java.rmi找不到错误
  3. VMware虚拟机出现Reason: Failed to lock the file
  4. 怎么通俗的理解Netty呢?
  5. 来客推仿拼多多电商商城小程序源码
  6. easyui tree设置选中节点的方法
  7. 输入输出(I/O)流。
  8. leetcode题库1277-- 统计全为 1 的正方形子矩阵
  9. VB获取Windows操作系统所有版本
  10. 洛谷 P3359 改造异或树
  11. Javascript:结合canvas、a标签根据url下载图片到本地
  12. 徐小湛概率论与数理统计课件_考研数学 徐小湛教授线性代数90讲
  13. CodeCanyon上的20种最佳WordPress登录表单
  14. 快乐又刺激的点名小程序:滚动点名+BGM
  15. 无人机倾斜摄影技术在不动产项目中的实际运用
  16. 人工智能NLP在金融领域的发展趋势和实践经验
  17. devcpp的简单使用
  18. a8处理器相当于骁龙几_曾受人追捧的A8处理器,放在现在是什么水平了?
  19. 从易经看程序员的职业人生:乾卦--天行健,君子以自强不息
  20. Leetcode:NO.15 三数之和 夹逼

热门文章

  1. Markdown中数学公式练习
  2. 回溯法模板(矩阵中操作)
  3. win10下gnuplot的安装
  4. USTC English Club Note20171019(2)
  5. 基于马克思哲学原理论外在美与内在美2017-12-31
  6. 串口通信模块5:串口操作自定义类(2)
  7. 最简单的c#Remoting编程
  8. [转]PowerDesigner使用
  9. 搭建XSS (跨网站指令码) 测试平台
  10. D进制的A+B (20)