问题描述
我在win7上安装了cygwin。我已经成功地将我的homedir移动到另一个目录(通过更改/ etc / passwd)。
现在我想添加一些别名。我创建了一个.bash_aliases文件并在.bashrc中激活。但现在这里是我的问题:
我添加了以下行:
alias la =ls -la
终端重新启动后,运行'la',我得到以下错误:
$ la
ls:未知选项 -
现在我只想测试:
alias lx =ls
然后我得到:
$ lx
-bash:$'ls\r':未知命令
我也尝试在命令前添加/ bin /,但它不会改变任何内容。如果我尝试在终端中调用ls或ls -la,我得到预期的结果。任何想法?
尝试以下操作:
-
使用单引号覆盖您的alais
别名la ='ls -la'
- p>对您正在编辑的所有文件运行
dos2unix
命令.bashrc
,.bash_aliases
。因为您的文件似乎有特殊字符。
I have cygwin installed on win7. I have successfully moved my homedir to another directory (by changinge /etc/passwd).
Now I am trying to add some aliases. I have created a .bash_aliases file and activated in .bashrc. But now here is my problem:
I have added the following line:
alias la="ls -la"
After a restart of the terminal, I tried to run 'la' and I get the following error:
$ la
ls: unknown option --
Now I tried only for testing:
alias lx="ls"
and afterwards I get:
$ lx
-bash: $'ls\r': unknown command
I also tried to add "/bin/" in front of the commands, but it doesn't change anything. If I try to call "ls" or "ls -la" in the terminal, I get the expected result. Any ideas?
Try following things:
Cover your alais with single quotes
alias la='ls -la'
run
dos2unix
command on all files your are editing i.e.bashrc
,.bash_aliases
. Because it seems your files are having special characters.
这篇关于Cygwin和别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!