mobaxterm - MobaXterm Busybox 奇怪的设置
问题描述
我正在使用 MobaXterm 便携版。我发现了一个奇怪的设置,总结在这里。
外部命令/bin
工作正常。例如,/bin/ssh.exe
我ssh
可以确定。
内部命令是
“重定向”到busybox,如
$ which cat /bin/cat $ ll /bin/cat lrwxrwxrwx 1 USER001 UsersGrp 16 Jul 24 07:42 /bin/cat -> /bin/busybox.exe
同时别名为显然不存在的文件。
$ type cat cat is aliased to `/bin/cat.exe'
这些别名显然优先于 PATH 中的文件,因此这些命令不起作用。
$ cat myfile
bash: /bin/cat.exe: No such file or directory
如果我取消别名,cat
不寻找/bin/cat.exe
but for /bin/busybox.exe
,一切都“恢复正常”。
$ unalias cat
$ cat myfile
Hello world
...
如何获得正常行为(没有别名或存在别名目标)?
我的意思是不要在 中写我自己的 unaliases .bashrc
,这不应该是必需的。此外,也许我会破坏一些东西。
为什么 MobaXterm 会设置这样的东西?
PS:在初始状态下,偶ls
也不行,同理。但是ll
有效,因为
$ type ll
ll is aliased to `_bbf ls -l'
$ type _bbf
_bbf is a function
...
解决方案
我怎样才能得到正常的行为?
解决方法:
unalias
手工ing,所以/bin/busybox.exe
实际使用。
下面我为此添加一个脚本。当临时目录可用时从临时目录复制
.exe
文件root
,因此使用外部版本。
为什么 MobaXterm 会设置这样的东西?
当不使用持久根 (/) 目录时,将获得
$ which cat
/bin/cat
$ ll /bin/cat
-rwxr-xr-x 1 RY16205 UsersGrp 49703 jul. 28 07:12 /bin/cat
$ type cat
cat is aliased to `/bin/cat.exe'
$ ll /bin/cat.exe
-rwxr-xr-x 1 USER001 UsersGrp 49703 jul. 28 07:12 /bin/cat.exe
$ cat myfile
Hello world
...
$ unalias cat
$ type cat
cat is hashed (/bin/cat)
$ cat myfile
Hello world
...
所以两者中cat
的任何一个都可以工作(内部busybox
和外部版本;我不知道它们是否完全相同)。这是因为/bin
指向C:\Users\user001\AppData\Local\Temp\Mxt108\bin
并且cat.exe
存在。
但是当使用持久根 (/) 目录时,/bin
指向<Persistent root (/) directory\bin
,并且cat.exe
不会在那里创建。root
一旦 MXT 关闭
,以前的临时目录就会被删除。所以这可能是 MobaXterm 的配置错误。
如果是这样,唯一的选择似乎是一种解决方法,如上所述。
反锯齿脚本:
#!/bin/bash
export ROOTDIR_WIN=$(cygpath -wl /)
if [[ ${ROOTDIR_WIN##*\\} == "Mxt108" ]] ; then
# Not using a Persistent root dir. Do not need to unalias.
echo "Not using a Persistent root dir. Do not need to unalias."
else
# Using a Persistent root dir. Need to unalias.
exe_linux_list="bash busybox chmod cygstart cygtermd cygwin-console-helper dircolors dwm_w32 echo grep ls MoTTY ssh ssh-pageant test twm_w32 wc xkbcomp_w32 XWin_MobaX"
for exe_linux in ${exe_linux_list} ; do
if [[ $(type -t ${exe_linux}) == "alias" ]] ; then
#type ${exe_linux}
unalias ${exe_linux}
fi
done
fi
推荐阅读
- django - OAuth 回调 URL 与 nginx 代理服务器行为不兼容
- typescript - 添加@types/react-select 后输入错误
- c# - 使用 TryValidateModel 的问题
- javascript - 如何在点击按钮时产生这种悬停效果?
- javascript - 设置用户代理并发布
- javascript - 如何使用我自己的自定义下拉菜单控制 DataTables 生成的选择菜单?
- android - 为什么 jcenter()、maven()、google() 的位置在 build.gradle 中很重要
- android - 将 WordPress 网站转换为 PWA
- python - 避免多重嵌套 for 循环
- python - TensorFlow:NotFoundError:资源匿名迭代器错误