假設有個檔案file_list.txt,內容如下:
# cat file_list.txt
1111
2222
3333
範例如下:
================== echo_value_from_file.sh ==================
#!/bin/sh
echo_file() {
exec < "file_list.txt"
while read want_param #把檔案內的值,assing給want_param參數
do
echo $want_param
done
}
echo_file
========================================================
執行結果如下:

沒有留言:
發佈留言