2017-10-10 71 views
0

對於我的magento安裝,我必須在語言目錄中添加一些符號鏈接。Bash - 在多個目錄中添加符號鏈接

我有以下語言目錄: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 

有沒有辦法使這個少redudant?

回答

1

爲什麼不嘗試使用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 
+0

正是我一直在尋找。是否可以回顯創建的符號鏈接?像'在目錄中添加符號鏈接應用程序','在目錄中添加符號鏈接皮膚'等。 –

+0

也可以使用$ PWD而不是/ path/to/magento/installation? –