這個腳本將所有的doc文件移動到指定的目錄....我設法把一個參數,但我面臨的問題是把腳本移動到的完整路徑例如我想運行這樣的下面在bash中的參數
./loo -d then path where im moving the files (i.e ./loo -d the second argument where files are moving to)
劇本,這是我的代碼
#!/bin/bash
From="/home/elg19/lone/doc"
To="/home/elg19/documents"
if [ $1 = -d ]; then
cd "$From"
for i in pdf txt doc; do
find . -type f -name "*.${i}" -exec mv "{}" "$To" \;
done
fi
我不明白你的問題。你知道「$ 1」,所以使用「$ 2」對你來說聽起來不是什麼挑戰。你能不能更好地解釋你錯過的東西? – Mat 2011-12-18 10:47:23
當我使用$ 2它不工作也許即時在某處作出一個錯誤,但如果你可以幫助我在哪裏我可以在我的代碼中插入$ 2我想我會更好地理解 – thequantumtheories 2011-12-18 11:28:24
張貼您嘗試的代碼,並準確解釋錯誤/問題它給。 – Mat 2011-12-18 11:29:06