相关疑难解决方法(0)

测量外壳中的管道吞吐量

有一个 shell 命令可以让您测量数据通过它的速度,因此您可以测量管道中命令的输出速度。所以而不是:

$ somecommand | anothercommand
Run Code Online (Sandbox Code Playgroud)

您可以执行以下操作:

$ somecommand | ??? | anothercommand
Run Code Online (Sandbox Code Playgroud)

我认为,吞吐量统计信息(字节/秒)会打印到 stderr。但我终生无法记住那个命令是什么。

command-line performance io pipe

39
推荐指数
2
解决办法
2万
查看次数

如何在 shell 中向 .bash_profile/.profile/bashrc 添加函数?

我有一个将纪元时间转换为日期的函数。这是定义

date1(){
  date -d @$1
}
Run Code Online (Sandbox Code Playgroud)

我希望能够写:

$ date1 xxxyyy
Run Code Online (Sandbox Code Playgroud)

其中 xxxyyy 是我传递给函数的参数,因此我可以获得相应的日期。我明白我必须将它添加在任.bash_profile.profile.bashrc然后它来源:

$ source file
Run Code Online (Sandbox Code Playgroud)

但是,我不确定应该把它放在哪个文件中。目前,我把它放在.profile. 但是要运行它,我必须source .profile每次都这样做。

理想情况下,当计算机像环境变量一样启动时,它应该使其可用。

shell bash profile function

32
推荐指数
3
解决办法
9万
查看次数

标签 统计

bash ×1

command-line ×1

function ×1

io ×1

performance ×1

pipe ×1

profile ×1

shell ×1