문제

In my script ; the following line

cat < /var/log/messages*

gives this error :

./msglog: line 5: /var/log/messages*: ambiguous redirect

How can i bypass this error ?

도움이 되었습니까?

해결책

Something like this may work as well

tail +1 /var/log/messages*

(OR)

Loop through all the files and print them

for filename in /var/log/messages*
do
    cat "$filename"
done

다른 팁

I suspect that /var/log/messages* refers to more than one file. what about this..

for i in /var/log/messages*
do
   cat < $i
done

use cat /var/log/messages* or even better something like

sudo tail -f -n5 $(find /var/log -name \*log)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top