linux - Bash - 在多个目录中添加符号链接(symbolic link)

标签 linux bash magento

对于我的 magento 安装,我必须在语言目录中添加一些符号链接(symbolic link)。

我有以下语言目录:EN、NL、DE、FR 和 IT。

这些是必须执行的命令。

ln -s /path/to/magento/installation/app /path/to/magento/installation/en/app
ln -s /path/to/magento/installation/skin /path/to/magento/installation/en/skin
ln -s /path/to/magento/installation/var /path/to/magento/installation/en/var
ln -s /path/to/magento/installation/js /path/to/magento/installation/en/js
ln -s /path/to/magento/installation/media /path/to/magento/installation/en/media
ln -s /path/to/magento/installation/app /path/to/magento/installation/nl/app
ln -s /path/to/magento/installation/skin /path/to/magento/installation/nl/skin
ln -s /path/to/magento/installation/var /path/to/magento/installation/nl/var
ln -s /path/to/magento/installation/js /path/to/magento/installation/nl/js
ln -s /path/to/magento/installation/media /path/to/magento/installation/nl/media
ln -s /path/to/magento/installation/app /path/to/magento/installation/ru/app
ln -s /path/to/magento/installation/skin /path/to/magento/installation/ru/skin
ln -s /path/to/magento/installation/var /path/to/magento/installation/ru/var
ln -s /path/to/magento/installation/js /path/to/magento/installation/ru/js
ln -s /path/to/magento/installation/media /path/to/magento/installation/ru/media
ln -s /path/to/magento/installation/app /path/to/magento/installation/fr/app
ln -s /path/to/magento/installation/skin /path/to/magento/installation/fr/skin
ln -s /path/to/magento/installation/var /path/to/magento/installation/fr/var
ln -s /path/to/magento/installation/js /path/to/magento/installation/fr/js
ln -s /path/to/magento/installation/media /path/to/magento/installation/fr/media
ln -s /path/to/magento/installation/app /path/to/magento/installation/de/app
ln -s /path/to/magento/installation/skin /path/to/magento/installation/de/skin
ln -s /path/to/magento/installation/var /path/to/magento/installation/de/var
ln -s /path/to/magento/installation/js /path/to/magento/installation/de/js
ln -s /path/to/magento/installation/media /path/to/magento/installation/de/media
ln -s /path/to/magento/installation/app /path/to/magento/installation/it/app
ln -s /path/to/magento/installation/skin /path/to/magento/installation/it/skin
ln -s /path/to/magento/installation/var /path/to/magento/installation/it/var
ln -s /path/to/magento/installation/js /path/to/magento/installation/it/js
ln -s /path/to/magento/installation/media /path/to/magento/installation/it/media

有没有办法减少冗余?

最佳答案

为什么不尝试使用 bash 脚本

#!/bin/bash
FOLDERS=(app skin var js media);
LOCALES=(en nl de fr it);
for i in FOLDERS; do
    for j in LOCALES; do
        ln -s /path/to/magento/installation/${FOLDERS[i]} /path/to/magento/installation/${LOCALES[j]}/${FOLDERS[i]}
    done
done

关于linux - Bash - 在多个目录中添加符号链接(symbolic link),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46661795/

相关文章:

php - 观察者可以破坏 Magento 中的事件吗?

c++ - 尝试连接到 tcp 套接字时连接被拒绝 (linux)

regex - 从命令响应中提取数据并将其存储在变量中

xml - Magento - 使用更新 XML 删除 block

php - Magento 可配置产品在多商店网站的前端缺货

linux - 从具有 CAP_SYS_ADMIN 和 CAP_IPC_LOCK 功能的 bash 脚本启动 perf

linux - "make"构建了错误的 python 版本

linux - 如何使用uniq命令进行排序以删除第一个字符和后面的n个字符

linux - 在drupal中应用补丁文件

bash - 在 bash 中使用包含空格的参数