"less" annoyance, filters html source

G.D.Thurman plug-discuss@lists.plug.phoenix.az.us
Wed, 4 Dec 2002 14:19:34 -0700 (MST)


On Wed, 4 Dec 2002, William Lindley wrote:

> On 4 Dec 2002, Craig White wrote:
> > why not just alias it
> 
> how do i make an alias so the command:
> 
>     $ less foo.html
> 
> becomes
> 
>     $ less foo.html:
> 
I can't provide an alias, but the following
shell script may work okay with Bourne compatible 
shells.  Let's call the command  myless.

# begin bourne shell script

files=""
suffix=""
for fname in $* ; do
   if test -f $fname ; then
      suffix=":"
   else
      suffix=""
   fi
   files="$files$fname$suffix "
done
less $files
exit $?

# end shell script

G.D.Thurman [CS/CIS Instructor]     
Scottsdale Community College
480.423.6110