.bashrc ALIAS 中带有空格的 Pb

发布于 2024-11-19 05:51:23 字数 1350 浏览 2 评论 0原文

我有完全相同的 pb : Cygwin/bash 别名中存在空格?

我在 bash 模式下使用 rxvt 并且我'我试图在 .bashrc 中设置我的别名 如果我遵循上一篇文章的答案,我的别名看起来像这样:

alias ma="/cygdrive/c/Program\ Files/Autodesk/Maya2011/bin/maya.exe"

但我得到了:

$ ma
: No such file or directoryiles/Autodesk/Maya2011/bin/maya.exe

我也尝试了这个合成:

alias ma="/cygdrive/c/Program Files/Autodesk/Maya2011/bin/maya.exe"

但它给了我

$ ma
bash: /cygdrive/c/Program: No such file or directory

所以,如果你们对如何解决这个问题有任何想法,那就太好了!

干杯

sk

PS:我编辑我的问题,因为我不允许回答我自己的问题,

谢谢你们的帮助!

我尝试用 Progra~1 Syntax 替换,但它不起作用。所以我想知道 pb 是否来自空格字符。

所以我尝试为不需要空格字符的 .exe 创建一个别名:

alias py1="/cygdrive/c/Python27/python.exe"
alias py2='/cygdrive/c/Python27/python.exe'
alias py3=/cygdrive/c/Python27/python.exe
alias py4='cd /cygdrive/c/Python27'

并且我还收到一个错误,

    $ py1
    : No such file or directorypython.exe
    $ py2
    : No such file or directorypython.exe
    $ py3
    : No such file or directorypython.exe
    $ py4
    : No such file or directoryn27

所以我想知道用于创建别名的 cygwin 合成器是否与 Linux 相同? 或者 Windows 7 x64 可能有问题?我真的不知道问题从何而来?

I have exactly the same pb :
Spaces in Cygwin/bash aliases?

i'm using rxvt in bash mode and i'm trying to setup my alias in the .bashrc
If i follow the answer of the previous post my alias look like this:

alias ma="/cygdrive/c/Program\ Files/Autodesk/Maya2011/bin/maya.exe"

but i get this :

$ ma
: No such file or directoryiles/Autodesk/Maya2011/bin/maya.exe

i also try this synthax :

alias ma="/cygdrive/c/Program Files/Autodesk/Maya2011/bin/maya.exe"

but it give me

$ ma
bash: /cygdrive/c/Program: No such file or directory

So if you guys have any idea on how to solve this, it would be great !

Cheers

sk

PS : i Edit my question because i'm not allowed to answer my own question

Thanks for your help guys !

i try to replace with the Progra~1 synthax and it doesn't work. So i was wondering if the pb comes from the space character.

so i try to create an alias to an .exe that doesn't need space character:

alias py1="/cygdrive/c/Python27/python.exe"
alias py2='/cygdrive/c/Python27/python.exe'
alias py3=/cygdrive/c/Python27/python.exe
alias py4='cd /cygdrive/c/Python27'

and i also get an error

    $ py1
    : No such file or directorypython.exe
    $ py2
    : No such file or directorypython.exe
    $ py3
    : No such file or directorypython.exe
    $ py4
    : No such file or directoryn27

so i wonder if the cygwin synthax for creating Alias is the same than the Linux one ?
or maybe there is something wrong with windows 7 x64 ? i really don't know where the problem come from ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

爱格式化 2024-11-26 05:51:23

两种可能的解决方法:

  1. 将路径中的 Program Files 替换为 Progra~1,或

  2. 创建符号链接以删除空格:mklink /D c:\programs "c:\Program Files" (公平地说,mklink 仅存在于Vista)

Two possible workarounds:

  1. Replace Program Files in your path with Progra~1, or

  2. Make a symlink to remove spaces: mklink /D c:\programs "c:\Program Files" (afair, mklink is only present starting from Vista)

旧时光的容颜 2024-11-26 05:51:23

使用高级编辑器(例如免费的 Notepad++)来修改非 DOS 格式的 .bashrc 文件。不要使用 Microsoft 的记事本,因为它将 CRLF 解释为换行符。而在 Mac/Unix 上换行符只是 LF。如果您错误地转换并保存了文件,您可以在 cygwin\etc\skel 中找到原始文件的副本。

要显示文件中使用的行尾符号,请在 Notepad++ 中使用 View ->;显示符号 ->显示行尾。

Use an advanced editor like the free Notepad++ to modify the not DOS format .bashrc file. Don't use Microsoft's Notepad becouse interprets CRLF as a newline. While on Mac/Unix newline is just LF. if you have mistakenly converted and saved the file, you can find a copy of the original in cygwin\etc\skel.

To show the End of Line symbol used in a file, in Notepad++ use View -> Show Symbol -> Show End of Line.

行至春深 2024-11-26 05:51:23

更简单的解决方案是将 Autodesk 目录从 C:\Program Files\ 移动到 C:\

The easier solution is to move Autodesk directory from C:\Program Files\ to C:\

巡山小妖精 2024-11-26 05:51:23

+1 用于使用 Cygwin 保存 .bashrc、.profile 等的文件类型:例如使用 TextPad,请确保在保存时选择文件类型 Unix。没有它......各种奇怪的事情。

+1 for file type to save .bashrc, .profile etc. with Cygwin: for example with TextPad be sure to select file type Unix on Save. Without it .... all sorts of bizareness.

万水千山粽是情ミ 2024-11-26 05:51:23

事情现在变得更好了

好吧,我重新安装了 cygwin,当我只安装这个时,

alias wp="/cygdrive/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe"

,现在它可以工作了!但是当我输入此内容时,

alias wp="/cygdrive/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe" 
alias nk="/cygdrive/c/Program\ Files/Nuke6.2v1/Nuke6.2.exe"

wp 给我一个错误

$ wp
: No such file or directoryiles/Windows NT/Accessories/wordpad.exe

,但 nk 别名有效,

所以我认为问题来自记事本创建的回车符,我尝试这样做:

alias wp="/cygdrive/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe" nk="/cygdrive/c/Program\ Files/Nuke6.2v1/Nuke6.2.exe" ma="/cygdrive/c/Program\ Files/Autodesk/Maya2011/bin/maya.exe"

它工作得很好!

所以就我而言,pb 是我猜在记事本中创建的回车符,它可能会创建 cygwin 不喜欢的隐藏字符。我将尝试直接在 vi 中编辑 .bashrc,以查看 pb 是来自记事本还是直接来自回车符。

如果您检查此语法是否适用于您的计算机,那将会很有趣,

alias myalias1="/cygdrive/c/.../pgm1.exe" 
alias myalias2="/cygdrive/c/.../pgm2.exe" 
alias myalias3="/cygdrive/c/.../pgm3.exe" 

再次感谢您的支持!

干杯!

well i reinstall cygwin and things are now going better

when i only put this

alias wp="/cygdrive/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe"

it now works ! but when i enter this

alias wp="/cygdrive/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe" 
alias nk="/cygdrive/c/Program\ Files/Nuke6.2v1/Nuke6.2.exe"

the wp give me an error

$ wp
: No such file or directoryiles/Windows NT/Accessories/wordpad.exe

but the nk alias works

so i figure that the problem was coming from the carriage return character created by notepad, i try this :

alias wp="/cygdrive/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe" nk="/cygdrive/c/Program\ Files/Nuke6.2v1/Nuke6.2.exe" ma="/cygdrive/c/Program\ Files/Autodesk/Maya2011/bin/maya.exe"

and it works perfectly !

so in my case the pb is i guess the carriage return created in notepad, it may create an hidden character that cygwin doesn't like. i'll try to edit my .bashrc in vi directly in order to see if the pb come from notepad or directly from carriage return.

it would be interesting if you check that if this syntax works on your computer

alias myalias1="/cygdrive/c/.../pgm1.exe" 
alias myalias2="/cygdrive/c/.../pgm2.exe" 
alias myalias3="/cygdrive/c/.../pgm3.exe" 

thanks again for your support !

cheers !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文