No subject
bogus at does.not.exist.com
bogus at does.not.exist.com
Thu Jun 18 21:25:59 MSD 2009
```
ac ()
{
out=$(/usr/bin/apt-cache search "$@")
if [ $(($(echo "$out"|/usr/bin/wc -l)+2)) -ge $LINES ]
then
echo "$out" | /usr/bin/less
else
echo "$out"
fi
}
export -f ac
'''
Using the $LINES Bash variable, which tells us how many lines our
current terminal is capable of displaying, makes it relatively simple to
decide whether to use a pipe or not. I also adjust the comparison a bit
to account for the prompt.
--
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *
More information about the TAG
mailing list