gpt4 book ai didi

macos - 在 Mac 上打开新终端窗口时如何停用 bash_history stats 打印?

转载 作者:行者123 更新时间:2023-11-29 09:42:21 27 4
gpt4 key购买 nike

我刚刚重新安装了 MacOS (OSX 10.12),当我重做我的 IDE 时,我得到了这个奇怪的 bash_history stats 对象,它会打印到每个新的终端窗口!它让我发疯,在查看了所有首选项和设置后,我似乎无法将其关闭!有谁知道为什么会突然发生这种情况?这与 iCloud 配置文件同步有关吗?这是下面的图片。非常感谢您的帮助!

Screenshot of bash terminal history stats

Last login: Wed Jul  5 03:23:51 on ttys005
/Users/admin/.bash_sessions/5D8EB886-1FE8-4DF6-AC4C-6ACE7B8CF803.historynew Stats {
dev: 16777220,
mode: 33152,
nlink: 1,
uid: 501,
gid: 20,
rdev: 0,
blksize: 4096,
ino: 1411298,
size: 0,
blocks: 0,
atime: 2017-07-05T10:24:18.000Z,
mtime: 2017-07-05T10:24:18.000Z,
ctime: 2017-07-05T10:24:18.000Z,
birthtime: 2017-07-05T10:24:18.000Z }
CafeMisto:~ admin$

所以/etc/profile是这样的:

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi

/etc/bashrc是这样的:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize

[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"

我检查了我的用户/个人资料主文件夹,没有 .bashrc...

最佳答案

我遇到了同样的问题,并追踪到在系统上全局安装了 touch NPM/Node 包,这放置了一个替代的 touch 命令在你的路径中。

$ ls -l $(触摸)
lrwxr-xr-x 1 timshel 管理员 74 7 月 18 日 12:47/usr/local/bin/touch -> ../../../Users/timshel/.config/yarn/global/node_modules/touch/bin/touch.js

(我使用 yarn global add 在我的系统上安装软件包,而不是 npm install -g)

在我的系统上,一个简单的 $ rm/usr/local/bin/touch 解决了这个问题(我认为 touch NPM 包是作为我的依赖项安装的系统;它甚至没有正确安装)。

此外,您仅在 Apple 终端中观察到此情况的原因是导致打印统计数据的 touch 命令位于 /etc/bashrc_Apple_Terminal 中;它仅通过 /etc/bashrc 中的以下行加载到 Apple 终端中:

[ -r "/etc/bashrc_$TERM_PROGRAM"] && 。 “/etc/bashrc_$TERM_PROGRAM”

/etc/bashrc_Apple_Terminal 未在其他终端模拟器中加载(例如您的 platformioIDE 示例)。

关于macos - 在 Mac 上打开新终端窗口时如何停用 bash_history stats 打印?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44923968/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com