Question

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 ?

Was it helpful?

Solution

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

OTHER TIPS

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top