日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

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

發布時間:2025/3/15 linux 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux中怎么删除只读变量,【Linux】【问题集锦】如何删除shell只读变量 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的linux中怎么删除只读变量,【Linux】【问题集锦】如何删除shell只读变量的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。