在Windows下定义Cygwin中的别名 [英] Defining aliases in Cygwin under Windows

查看:393
本文介绍了在Windows下定义Cygwin中的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在cygwin中定义一些别名,但没有成功。我在 .bashrc 文件的末尾这样做。

  alias foo ='pwd'

我试图在<$ c $在cygwin的 home 文件夹中和Windows用户的主文件夹中的 .bashrc 文件 C:\Users \Nuno\ 。在这两种情况下,我只是将此行附加到 /etc/skel/.bashrc 文件的副本。在任一情况下,它都不起作用。



我以前工作过。我不得不重新安装Cygwin,因为它从来没有正常工作。我已经删除所有文件(或至少这样,当做重新安装)。我也注意到,在第一次安装(当它的工作)cygwin已经在 home 文件夹中创建.bash文件。



我在运行Windows 7的计算机上。



:我的cygwin主文件夹设置为Windows主文件夹 C:\Users \Nuno\ 。我放置了我认为是有效的 .bashrc 文件,但它仍然不工作。



提前感谢。

解决方案

如果你无论什么原因无法或愿意删除Windows的HOME环境变量,我只想添加一个解决方法。



通常Cygwin的快捷方式执行

  C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico  -  


<$>

p $ p> @echo off
set HOME =
start C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

这将启动一个Cygwin窗口,其主目录设置不会被Windows环境变量覆盖。


I am trying to define some aliases in cygwin, but with no success. I am doing so like this at the end of the .bashrc file.

alias foo='pwd'

I have tried to add this line in a .bashrc file in both inside the home folder of cygwin and in the home folder for the Windows user I am on C:\Users\Nuno\. In both cases I have just appended this line to a copy of the /etc/skel/.bashrc file. In either cases, it didn't work.

I had this working before. I had to reinstall Cygwin and ever since it never worked properly again. I have removed all files (or at least think so, when doing the reinstallation). I have also noticed that in the first install (when it was working) cygwin already was creating .bash files in the home folder. Now, it doesn't.

I am on a machine running Windows 7.

EDIT: My cygwin home folder is set to the Windows home folder C:\Users\Nuno\. I have placed what I think is a valid .bashrc file there, but it still doesn't work.

Thanks in advance.

解决方案

As me_and already explained what's going on I just want to add a workaround should you for whatever reason not be able or willing to remove Windows' HOME environment variable.

Normally the shortcut for Cygwin executes

C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

Instead you can create a batchfile with the following content and start that:

@echo off
set HOME=
start C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

That will start a a Cygwin windows whose home directory settings are not overridden by a Windows environment variable.

这篇关于在Windows下定义Cygwin中的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆