在Mac上打开新的终端窗口时,如何停用bash_history统计信息打印? [英] How to deactivate bash_history stats print when opening a new terminal window on my mac?
问题描述
我刚刚重新安装了MacOS(OSX 10.12),并且在重做IDE时,得到了这个奇怪的bash_history stats对象,该对象会打印到每个新的终端窗口中!它使我疯狂,在浏览了所有首选项之后,我似乎无法将其关闭!有谁知道为什么这突然发生?与iCloud配置文件同步有关吗?这是下面的图片.非常感谢您的帮助!
I just reinstalled MacOS (OSX 10.12) and as I'm redoing my IDEs and such I get this strange bash_history stats object that prints to every new terminal window! It's driving me bonkers, and after looking through all the preferences an settings I can't seem to turn it off! Does anyone know why this is suddenly happening? Is it something to do with iCloud Profile Syncing? Here's s picture below. Thanks so much for your help!
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 ...
and I've checked my user/profile home folder and there's no .bashrc...
推荐答案
我遇到了同样的问题,并将其追溯到在系统上全局安装了touch
NPM/Node软件包的情况下,这是一个替代方案路径中的touch
命令.
I've had the same problem, and have tracked it down to having the touch
NPM/Node package installed globally on the system, which places an alternative touch
command in your PATH.
$ ls -l $(which touch)
lrwxr-xr-x 1 timshel admin 74 18 Jul 12:47 /usr/local/bin/touch -> ../../../Users/timshel/.config/yarn/global/node_modules/touch/bin/touch.js
$ ls -l $(which touch)
lrwxr-xr-x 1 timshel admin 74 18 Jul 12:47 /usr/local/bin/touch -> ../../../Users/timshel/.config/yarn/global/node_modules/touch/bin/touch.js
(我已经使用yarn global add
在我的系统上而不是npm install -g
上安装软件包)
(I've used yarn global add
to install packages on my system rather than npm install -g
)
在我的系统上,一个简单的$ rm /usr/local/bin/touch
修复了该问题(我认为安装了touch
NPM软件包是对我系统的依赖;它甚至没有正确安装).
On my system, a simple $ rm /usr/local/bin/touch
fixed the issue (I think the touch
NPM package got installed as a dependency on my system; it isn't even installed properly).
此外,您仅在Apple Terminal中观察到此问题的原因是,导致打印Stat数据的touch
命令位于/etc/bashrc_Apple_Terminal
中;仅通过/etc/bashrc
中的以下行在Apple Terminal中加载:
Also, the reason you only observed this in Apple Terminal is that the touch
command which causes the Stat data to be printed is located in /etc/bashrc_Apple_Terminal
; which is only loaded in Apple Terminal by the following line in /etc/bashrc
:
[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"
/etc/bashrc_Apple_Terminal
未加载到其他终端仿真器中(例如您的platformioIDE示例).
/etc/bashrc_Apple_Terminal
isn't loaded in other terminal emulators (e.g. your platformioIDE example).
这篇关于在Mac上打开新的终端窗口时,如何停用bash_history统计信息打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!