동일한 스크립트에 여러 줄 입력을 허용하려면 어떻게해야합니까?동일한 스크립트에 여러 입력을 받아들이는 방법
while read input_source
do
# Do something with $input_source
done
동일한 스크립트에 여러 줄 입력을 허용하려면 어떻게해야합니까?동일한 스크립트에 여러 입력을 받아들이는 방법
while read input_source
do
# Do something with $input_source
done
루프에 대한 추가 :
#!/bin/bash
echo 'Enter file names (wild cards OK)'
read input_source
if test -f "$input_source"
then
sort $var | uniq -c | head -10
fi
는 while 루프를 사용하여 또는 다른 말로 다음 스크립트로 여러 파일을 처리하는
#!/bin/bash
echo 'Enter file names (wild cards OK)'
read files
for input_source in $files ; do
if test -f "$input_source" ; then
sort $var | uniq -c | head -10 # You probably should include $input_source somewhere
fi
done
그냥 고양이 모든 파일을 그 입력 패턴과 일치 : -
#!/bin/bash
echo 'Enter file names (wild cards OK)'
read input_source
cat $input_source | sort | uniq -c | head -10
감사합니다! 그리고 내가 $ sort_source | 유니크 -c | 사용자가 파일의 끝을 알릴 때까지 입력 파일에 대해 -10을 계속 반복하십시오. Ctrl-d를 파일 이름으로 입력하면됩니다. 어떤 아이디어? – Zerg12