相关疑难解决方法(0)

每次推送到 Bitbucket 时如何避免被询问密码

我在本指南的帮助下设置了我的 ssh 东西,它曾经运行良好(我可以在hg push没有被要求输入密码的情况下运行)。考虑到我仍在使用相同的主目录,从那时到现在可能会发生什么。

$ cat .hg/hgrc 
[paths]
default = ssh://hg@bitbucket.org/tshepang/bloog

$ hg push
Enter passphrase for key '/home/wena/.ssh/id_rsa': 
pushing to ssh://hg@bitbucket.org/tshepang/bloog
searching for changes
...
Run Code Online (Sandbox Code Playgroud)

ssh key-authentication

271
推荐指数
5
解决办法
32万
查看次数

如何在 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

function ×1

key-authentication ×1

profile ×1

shell ×1

ssh ×1