2016-02-23 123 views

回答

3
for dir in test_* 
do 
    mkdir "$dir/ids" 
    mv "$dir"/*.css "$dir/ids/" 
done 

$

0

你可以這樣做:

mkdir test_1/ids test_2/ids; mv test_1/*.css test_1/ids; mv test_2/*.css test_2/ids 
1

我不知道爲什麼你需要一個例子,可以用幾行解決。當你需要在很多地方重複類似的呼叫時,引入一個功能:

function movetosubdir { 
    echo "Some code as given in other answers, perhaps use $1 and $2" 
} 

# Main code 
# oneliner: 
movetosubdir 
+0

謝謝。我不需要一個,認爲它會很好 –

相關問題