3

Я пытаюсь создать мягкие ссылки на двоичные файлы Mingw в Cygwin.

На данный момент у меня есть: find /cygdrive/c/MinGW/bin/ -name "*.exe" -exec ln -s {} basename {} \;

но я получаю:

ln: target `/cygdrive/c/MinGW/bin/addr2line.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/ar.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/as.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/c++.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/c++filt.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/cc.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/cpp.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/dlltool.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/dllwrap.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/elfedit.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/envsubst.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/g++.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/gcc.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/gcov.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/gdb.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/gdbserver.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/gettext.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/gprof.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/iconv.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/ld.bfd.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/ld.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw-get.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-c++.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-cc.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-g++-4.6.2.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-g++.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-gcc-4.6.2.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-gcc.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/mingw32-make.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgattrib.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgcat.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgcmp.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgcomm.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgconv.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgen.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgexec.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgfilter.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgfmt.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msggrep.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msginit.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgmerge.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msgunfmt.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/msguniq.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/ngettext.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/nm.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/objcopy.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/objdump.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/pkginfo.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/quserex-test.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/ranlib.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/readelf.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/recode-sr-latin.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/size.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/strings.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/strip.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/windmc.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/windres.exe' is not a directory
ln: target `/cygdrive/c/MinGW/bin/xgettext.exe' is not a directory

3 ответа3

4

Так как ln принимает каталоги как цели:

ln -s /cygdrive/c/MinGW/bin/*.exe /path/to/otherdirectory/
3

Чтобы заставить вашу команду работать, я не думаю, что вы можете избежать подстрела, что-то вроде:

find /cygdrive/c/MinGW/bin/ -name "*.exe" -print0 | xargs -0 -n1 bash -c 'ln -s {} $(basename {})'

Если все файлы находятся в одном каталоге, вы также можете использовать cp -s:

cp -s /cygdrive/c/MinGW/bin/* .
2
for i in /source/directory/*.exe; do
    ln -s $i /destination/directory/`basename $i`
done

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .