为什么我的.bashrc不能在cygwin下读取?

我的.bashrc如下所示:

alias name@server="ssh server sname" echo "bashrc read" 

echo语句只是用来检查是否被读取。 但是回声什么都不做。 我想设置一个更快的ssh的别名到一个盒子做一个特定的命令,这是远程盒子上的工作别名。

我有一段时间没有使用cygwin,但我猜它是想要〜/ .bash_profile。 简单的修复testing。

 ln -s ~/.bashrc ~/.bash_profile 

或者如果〜/ .bash_profile存在,则源.bashrc。

 if [ -f ~/.bashrc ] then . ~/.bashrc fi 

因为你的cygwin bash是一个loginshell,它读取configuration文件,而不是rc文件。 请参阅jtimberman对答案第二部分的回答。

正如jtimberman所说的那样,它可能使用了.bash_profile 。 另一个要记住的是.profile

你需要解决的IP。 只需将“ipaddress sname”添加到C:\ WINDOWS \ system32 \ drivers \ etc \ hosts文件中即可解决。

例如:127.0.0.1 localhost [ipaddress sname]