Subject: Re: add less in /rescue
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 07/02/2004 18:01:28
> Occasionally today i had to actually use tools from /rescue and i found quite 
> annoying feature: with mounted root / i don't see less, more, head, tail, 
> grep, vi - nothing. So i cannot actually inspect for example output of dmesg.
> 
> Any ideas ? Looks like /rescut need some tools to manage text output.

dmesg 3<&0 | while read -r line; do \
	echo "$line"; c=$(($c+1)); [ $c -lt 20 ] && continue; \
	read xxx <&3; c=0; \
done

should work - but seems to provoke a bug (and core dump!) in /bin/sh!
But you can do:

(exec 3<&0; dmesg | while read -r line; do \
	echo "$line"; c=$(($c+1)); [ $c -lt 20 ] && continue; \
	read xxx <&3; c=0; \
done)

The other option is to mount / and /usr then chroot to /

	David

-- 
David Laight: david@l8s.co.uk