2 # lesspipe.sh, a preprocessor for less (version 1.82)
3 #===============================================================================
4 ### THIS FILE IS GENERATED FROM lesspipe.sh.in, PLEASE GET THE TAR FILE
5 ### from http://sourceforge.net/projects/lesspipe/
6 ### AND RUN configure TO GENERATE A lesspipe.sh THAT WORKS IN YOUR ENVIRONMENT
7 #===============================================================================
9 # Usage: lesspipe.sh is called when the environment variable LESSOPEN is set:
10 # LESSOPEN="|lesspipe.sh %s"; export LESSOPEN (sh like shells)
11 # setenv LESSOPEN "|lesspipe.sh %s" (csh, tcsh)
12 # Use the fully qualified path if lesspipe.sh is not in the search path
13 # View files in multifile archives:
14 # less archive_file:contained_file
15 # This can be used to extract ASCII files from a multifile archive:
16 # less archive_file:contained_file>extracted_file
17 # As less is not good for extracting raw data use instead:
18 # lesspipe.sh archive_file:contained_file>extracted_file
19 # Even a file in a multifile archive that itself is contained in yet
20 # another archive can be viewed this way:
21 # less super_archive:archive_file:contained_file
22 # Display the last file in the file1:..:fileN chain in raw format:
23 # Suppress input filtering: less file1:..:fileN: (append a colon)
24 # Suppress decompression: less file1:..:fileN:: (append 2 colons)
26 # Required programs and supported formats: see the separate file README
27 # License: GPL (see file LICENSE)
28 # History: see the separate file ChangeLog
29 # Author: Wolfgang Friebel, DESY (Wolfgang.Friebel AT desy.de)
31 #===============================================================================
32 ( [[ -n 1 && -n 2 ]] ) > /dev/null 2>&1 || exec zsh -y --ksh-arrays -- "$0" ${1+"$@"}
33 #setopt KSH_ARRAYS SH_WORD_SPLIT 2>/dev/null
38 dir=${dir%%lesspipe.sh*\%s}
43 command -v "$1" > /dev/null 2>&1 && return 0 || return 1
48 file -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z
51 sep=: # file name separator
52 altsep== # alternate separator character
53 if [[ -f "$1" && "$1" = *$sep* || "$1" = *$altsep ]]; then
58 if cmd_exist mktemp; then
59 tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/lesspipe.XXXXXXXXXX")
62 # nexttmp -d returns a directory
63 mktemp $1 "${tmpdir}/XXXXXXXX"
66 tmpdir=${TMPDIR:-/tmp}/lesspipe.$RANDOM
70 new="$tmpdir/lesspipe.$RANDOM"
71 [[ "$1" = -d ]] && mkdir $new
75 [[ -d "$tmpdir" ]] || exit 1
76 trap "rm -rf '$tmpdir'" 0
81 if [[ -z "$iconv" ]]; then
82 arg=$(printf "%s$(command iconv --help 2>/dev/null | \
83 sed -n 's/.*\(--.*-subst=\)\(FORMATSTRING\).*/\1\\033[7m?\\033[m/p' | \
85 if [[ -n "$arg" ]]; then
86 iconv="command iconv -c $arg -t //TRANSLIT"
88 iconv="command iconv -c"
91 if $iconv "$@" > /dev/null 2>&1; then
92 msg "append $sep to filename to view the $2 encoded data"
98 if [[ -n "$LESSQUIET" ]]; then
105 # wrapper for 'file' command
108 if [[ "$1" = - ]]; then
109 dd bs=40000 count=1 > "$tmpdir/file" 2>/dev/null
110 set "$tmpdir/file" "$2"
114 # type=" $(filecmd -b "$1")" # not supported by all versions of 'file'
115 type=$(filecmd "$1" | cut -d : -f 2-)
116 if [[ "$type" = " empty" ]]; then
117 # exit if file returns "empty" (e.g., with "less archive:nonexisting_file")
119 elif [[ "$type" = *XML* && "$name" = *html ]]; then
120 type=" HTML document text"
121 elif [[ ("$type" = *HTML* || "$type" = *ASCII*) && "$name" = *xml ]]; then
122 type=" XML document text"
123 elif [[ "$type" != *lzip\ compressed* && ("$name" = *.lzma || "$name" = *.tlz) ]]; then
124 type=" LZMA compressed data"
125 elif [[ ("$type" = *Zip* || "$type" = *ZIP*) && ("$name" = *.jar || "$name" = *.xpi) ]]; then
126 type=" Zip compressed Jar archive"
127 elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.ppt) ]]; then
128 type=" PowerPoint document"
129 elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.xls) ]]; then
130 type=" Excel document"
138 while [[ "$rest1" = ::* ]]; do
139 if [[ "$rest1" = "::" ]]; then
142 rest1="${rest1#$sep$sep}"
143 file1="${rest1%%$sep*}"
144 rest1="${rest1#$file1}"
148 rest11="${rest1#$sep}"
149 file2="${rest11%%$sep*}"
150 rest2="${rest11#$file2}"
151 while [[ "$rest2" = ::* ]]; do
152 if [[ "$rest2" = "::" ]]; then
155 rest2="${rest2#$sep$sep}"
156 file2="${rest2%%$sep*}"
157 rest2="${rest2#$file2}"
158 file2="${rest11%$rest2}"
161 if [[ "$file2" != "" ]]; then
164 rest2="${rest11#$file2}"
166 if [[ "$cmd" = "" ]]; then
167 type=$(filetype "$file1") || exit 1
168 get_cmd "$type" "$file1" "$rest1"
169 if [[ "$cmd" != "" ]]; then
172 isfinal "$type" "$file1" "$rest11"
174 elif [[ "$c1" = "" ]]; then
176 type=$("${c1[@]}" | filetype -) || exit 1
177 get_cmd "$type" "$file1" "$rest1"
178 if [[ "$cmd" != "" ]]; then
181 "${c1[@]}" | isfinal "$type" - "$rest11"
183 elif [[ "$c2" = "" ]]; then
185 type=$("${c1[@]}" | "${c2[@]}" | filetype -) || exit 1
186 get_cmd "$type" "$file1" "$rest1"
187 if [[ "$cmd" != "" ]]; then
190 "${c1[@]}" | "${c2[@]}" | isfinal "$type" - "$rest11"
192 elif [[ "$c3" = "" ]]; then
194 type=$("${c1[@]}" | "${c2[@]}" | "${c3[@]}" | filetype -) || exit 1
195 get_cmd "$type" "$file1" "$rest1"
196 if [[ "$cmd" != "" ]]; then
199 "${c1[@]}" | "${c2[@]}" | "${c3[@]}" | isfinal "$type" - "$rest11"
201 elif [[ "$c4" = "" ]]; then
203 type=$("${c1[@]}" | "${c2[@]}" | "${c3[@]}" | "${c4[@]}" | filetype -) || exit 1
204 get_cmd "$type" "$file1" "$rest1"
205 if [[ "$cmd" != "" ]]; then
208 "${c1[@]}" | "${c2[@]}" | "${c3[@]}" | "${c4[@]}" | isfinal "$type" - "$rest11"
210 elif [[ "$c5" = "" ]]; then
212 type=$("${c1[@]}" | "${c2[@]}" | "${c3[@]}" | "${c4[@]}" | "${c5[@]}" | filetype -) || exit 1
213 get_cmd "$type" "$file1" "$rest1"
214 if [[ "$cmd" != "" ]]; then
215 echo "$0: Too many levels of encapsulation"
217 "${c1[@]}" | "${c2[@]}" | "${c3[@]}" | "${c4[@]}" | "${c5[@]}" | isfinal "$type" - "$rest11"
225 if [[ "$1" = *[bg]zip*compress* || "$1" = *compress\'d\ * || "$1" = *packed\ data* || "$1" = *LZMA\ compressed* || "$1" = *lzip\ compressed* || "$1" = *[Xx][Zz]\ compressed* ]]; then ## added '#..then' to fix vim's syntax parsing
226 if [[ "$3" = $sep$sep ]]; then
228 elif [[ "$1" = *bzip*compress* ]] && cmd_exist bzip2; then
230 if [[ "$2" != - ]]; then filen="$2"; fi
232 *.bz2) filen="${filen%.bz2}";;
233 *.tbz) filen="${filen%.tbz}.tar";;
236 elif [[ "$1" = *LZMA\ compressed* ]] && cmd_exist lzma; then
238 if [[ "$2" != - ]]; then filen="$2"; fi
240 *.lzma) filen="${filen%.lzma}";;
241 *.tlz) filen="${filen%.tlz}.tar";;
243 elif [[ "$1" = *gzip\ compress* || "$1" = *compress\'d\ * || "$1" = *packed\ data* ]]; then ## added '#..then' to fix vim's syntax parsing
245 if [[ "$2" != - ]]; then filen="$2"; fi
247 *.gz) filen="${filen%.gz}";;
248 *.tgz) filen="${filen%.tgz}.tar";;
250 elif [[ "$1" = *[Xx][Zz]\ compressed* ]] && cmd_exist xz; then
252 if [[ "$2" != - ]]; then filen="$2"; fi
254 *.xz) filen="${filen%.xz}";;
255 *.txz) filen="${filen%.txz}.tar";;
263 if [[ "$file2" != "" ]]; then
264 if [[ "$1" = *\ tar* || "$1" = *\ tar* ]]; then
265 cmd=(istar "$2" "$file2")
266 elif [[ "$1" = *Debian* ]]; then
268 if [[ "$file2" = control/* ]]; then
269 istemp "ar p" "$2" control.tar.gz | gzip -dc - > "$t"
272 istemp "ar p" "$2" data.tar.gz | gzip -dc - > "$t"
274 cmd=(istar "$t" "$file2")
275 elif [[ "$1" = *RPM* ]] && cmd_exist cpio && ( cmd_exist rpm2cpio || cmd_exist rpmunpack ); then
276 cmd=(isrpm "$2" "$file2")
277 elif [[ "$1" = *Zip* || "$1" = *ZIP* ]] && cmd_exist unzip; then
278 cmd=(istemp "unzip -avp" "$2" "$file2")
279 elif [[ "$1" = *RAR\ archive* ]]; then
280 if cmd_exist unrar; then
281 cmd=(istemp "unrar p -inul" "$2" "$file2")
282 elif cmd_exist rar; then
283 cmd=(istemp "rar p -inul" "$2" "$file2")
285 elif [[ "$1" = *7-zip\ archive* || "$1" = *7z\ archive* ]] && cmd_exist 7za; then
286 cmd=(istemp "7za e -so" "$2" "$file2")
287 elif [[ "$1" = *7-zip\ archive* || "$1" = *7z\ archive* ]] && cmd_exist 7zr; then
288 cmd=(istemp "7zr e -so" "$2" "$file2")
289 elif [[ "$1" = *[Cc]abinet* ]] && cmd_exist cabextract; then
290 cmd=(iscab "$2" "$file2")
291 elif [[ "$1" = *\ ar\ archive* ]]; then
292 cmd=(istemp "ar p" "$2" "$file2")
293 elif [[ "$1" = *ISO\ 9660* ]] && cmd_exist isoinfo; then
294 cmd=(isoinfo "-i$2" "-x$file2")
296 if [[ "$cmd" != "" ]]; then
304 if [[ "$1" = - ]]; then
309 cabextract -pF "$2" "$1"
313 $tarcmd Oxf "$1" "$2" 2>/dev/null
318 if [[ "$1" != *.dvi ]]; then
333 if [[ "$t" = - ]]; then
337 if [[ $# -gt 0 ]]; then
338 $prog "$t" "$@" 2>/dev/null
340 $prog "$t" 2>/dev/null
348 if [[ "$1" = - ]]; then
350 if [[ $# -gt 0 ]]; then
351 $prog "$@" 2>/dev/null
356 $prog "$@" 2>/dev/null
361 if cmd_exist rpm2cpio && cmd_exist cpio; then
363 if [[ "$1" = - ]]; then
368 # setup $b as a batch file containing "$b.out"
372 # to support older versions of cpio the --to-stdout option is not used here
373 rpm2cpio "$1" 2>/dev/null|cpio -i --quiet --rename-batch-file "$b" "$2"
375 elif cmd_exist rpmunpack && cmd_exist cpio; then
376 # rpmunpack will write to stdout if it gets file from stdin
377 # extract file $2 from archive $1, assume that cpio is sufficiently new
378 # (option --to-stdout existing) if rpmunpack is installed
379 cat "$1" | rpmunpack | gzip -cd | cpio -i --quiet --to-stdout "$2"
384 if cmd_exist html2text || cmd_exist elinks || cmd_exist links || cmd_exist lynx || cmd_exist w3m; then
389 #parsexml () { nodash "elinks -dump -default-mime-type text/xml" "$1"; }
391 if [[ "$PARSEHTML" = no ]]; then
392 msg "No suitable tool for HTML parsing found, install one of html2text, elinks, links, lynx or w3m"
394 elif cmd_exist html2text; then
395 html2text -style pretty "$1"
396 elif cmd_exist lynx; then
397 if [[ "$1" = - ]]; then set - -stdin; fi
398 lynx -dump -force_html "$1" && return
399 elif cmd_exist w3m; then
400 nodash "w3m -dump -T text/html" "$1"
401 elif cmd_exist elinks; then
402 nodash "elinks -dump -force-html" "$1"
403 elif cmd_exist links; then
404 if [[ "$1" = - ]]; then set - -stdin; fi
405 links -dump -force_html "$1"
411 if [[ "$3" = $sep$sep ]]; then
414 elif [[ "$3" = $sep* ]]; then
415 if [[ "$3" = $sep ]]; then
416 msg "append :. or :<filetype> to activate syntax highlighting"
421 if cmd_exist code2color; then
422 code2color $PPID ${in_file:+"$in_file"} $lang "$2"
423 if [[ $? = 0 ]]; then
432 # color requires -r or -R when calling less
434 if [[ $(tput colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then
435 COLOR="--color=always"
438 if [[ "$1" = *No\ such* ]]; then
440 elif [[ "$1" = *directory* ]]; then
441 cmd=(ls -lA $COLOR "$2")
442 if ! ls $COLOR > /dev/null 2>&1; then
444 if ! ls -lA -G > /dev/null 2>&1; then
448 msg "This is a directory, showing the output of ${cmd[@]}"
449 if [[ ${cmd[2]} = '-G' ]]; then
450 CLICOLOR_FORCE=1 "${cmd[@]}"
454 elif [[ "$1" = *\ tar* || "$1" = *\ tar* ]]; then
455 msg "use tar_file${sep}contained_file to view a file in the archive"
456 if [[ -n $COLOR ]] && cmd_exist tarcolor; then
457 $tarcmd tvf "$2" | tarcolor
461 elif [[ "$1" = *RPM* ]]; then
462 header="use RPM_file${sep}contained_file to view a file in the RPM"
463 if cmd_exist rpm; then
465 istemp "rpm -qivp" "$2"
468 if cmd_exist cpio && cmd_exist rpm2cpio; then
470 echo "================================= Content ======================================"
471 istemp rpm2cpio "$2" 2>/dev/null|cpio -i -tv 2>/dev/null
472 elif cmd_exist cpio && cmd_exist rpmunpack; then
474 echo "================================= Content ======================================"
475 cat "$2" | rpmunpack | gzip -cd | cpio -i -tv 2>/dev/null
477 msg "please install rpm2cpio or rpmunpack to see the contents of RPM files"
479 elif [[ "$1" = *roff* ]] && cmd_exist groff; then
481 if [[ $LANG != *UTF*8* && $LANG != *utf*8* ]]; then
482 if [[ "$LANG" = ja* ]]; then
489 if [[ "$2" = *.me ]]; then
491 elif [[ "$2" = *.ms ]]; then
494 msg "append $sep to filename to view the nroff source"
495 groff -s -p -t -e -T$DEV -m$MACRO "$2"
496 elif [[ "$1" = *Debian* ]]; then
497 msg "use Deb_file${sep}contained_file to view a file in the Deb"
498 if cmd_exist dpkg; then
499 nodash "dpkg -I" "$2"
502 istemp "ar p" "$2" control.tar.gz | gzip -dc - | $tarcmd tvf - | sed -r 's/(.{48})\./\1control/'
505 istemp "ar p" "$2" data.tar.gz | gzip -dc - | $tarcmd tvf -
506 # do not display all perl text containing pod using perldoc
507 #elif [[ "$1" = *Perl\ POD\ document\ text* || "$1" = *Perl5\ module\ source\ text* ]]; then
508 elif [[ "$1" = *Perl\ POD\ document\ text* ]] && cmd_exist perldoc; then
509 msg "append $sep to filename to view the perl source"
511 elif [[ "$1" = *\ script* ]]; then
512 set "plain text" "$2"
513 elif [[ "$1" = *text\ executable* ]]; then
514 set "plain text" "$2"
515 elif [[ "$1" = *PostScript* ]]; then
516 if cmd_exist pstotext; then
517 msg "append $sep to filename to view the postscript file"
519 elif cmd_exist ps2ascii; then
520 msg "append $sep to filename to view the postscript file"
523 msg "install pstotext or ps2ascii to view a textual representation of the file contents"
525 elif [[ "$1" = *executable* ]]; then
526 msg "append $sep to filename to view the raw file"
528 elif [[ "$1" = *\ ar\ archive* ]]; then
529 msg "use library${sep}contained_file to view a file in the archive"
531 elif [[ "$1" = *shared* ]] && cmd_exist nm; then
532 msg "This is a dynamic library, showing the output of nm"
534 elif [[ "$1" = *Zip* || "$1" = *ZIP* ]] && cmd_exist unzip; then
535 msg "use zip_file${sep}contained_file to view a file in the archive"
536 istemp "unzip -lv" "$2"
537 elif [[ "$1" = *RAR\ archive* ]]; then
538 if cmd_exist unrar; then
539 msg "use rar_file${sep}contained_file to view a file in the archive"
540 istemp "unrar v" "$2"
541 elif cmd_exist rar; then
542 msg "use rar_file${sep}contained_file to view a file in the archive"
545 elif [[ "$1" = *7-zip\ archive* || "$1" = *7z\ archive* ]] && cmd_exist 7za; then
547 res=$(istemp "7za l" "$2")
548 if [[ "$res" = *\ 1\ file* ]]; then
549 msg "a 7za archive containing one file was silently unpacked"
550 if [[ "$2" != - ]]; then
551 7za e -so "$2" 2>/dev/null
553 # extract name of temporary file containing the 7za archive
554 t=${res#*Listing\ archive:\ }
558 7za e -so $t 2>/dev/null
561 msg "use 7za_file${sep}contained_file to view a file in the archive"
564 elif [[ "$1" = *7-zip\ archive* || "$1" = *7z\ archive* ]] && cmd_exist 7zr; then
566 res=$(istemp "7zr l" "$2")
567 if [[ "$res" = *\ 1\ file* ]]; then
568 msg "a 7za archive containing one file was silently unpacked"
569 if [[ "$2" != - ]]; then
570 7zr e -so "$2" 2>/dev/null
572 # extract name of temporary file containing the 7za archive
573 t=${res#*Listing\ archive:\ }
577 7zr e -so $t 2>/dev/null
580 msg "use 7za_file${sep}contained_file to view a file in the archive"
583 elif [[ "$1" = *[Cc]abinet* ]] && cmd_exist cabextract; then
584 msg "use cab_file${sep}contained_file to view a file in the cabinet"
585 istemp "cabextract -l" "$2"
586 elif [[ "$1" = *\ DVI* ]] && cmd_exist dvi2tty; then
587 msg "append $sep to filename to view the raw DVI file"
589 elif [[ "$PARSEHTML" = yes && "$1" = *HTML* ]]; then
590 msg "append $sep to filename to view the HTML source"
592 elif [[ "$PARSEHTML" = yes && "$1" = *PDF* ]] && cmd_exist pdftohtml; then
593 msg "append $sep to filename to view the PDF source"
595 cat "$2" > "$t"; pdftohtml -stdout "$t" | parsehtml -
596 elif [[ "$1" = *PDF* ]] && cmd_exist pdftotext; then
597 msg "append $sep to filename to view the PDF source"
598 istemp pdftotext "$2" -
599 elif [[ "$1" = *DjVu* ]] && cmd_exist djvutxt; then
600 msg "append $sep to filename to view the DjVu source"
602 elif [[ "$1" = *Microsoft\ Word* || "$1" = *Microsoft\ Office* ]]; then
603 if cmd_exist antiword; then
604 msg "append $sep to filename to view the raw word document"
606 elif cmd_exist catdoc; then
607 msg "append $sep to filename to view the raw word document"
610 msg "install antiword or catdoc to view human readable text"
613 elif [[ "$1" = *Rich\ Text\ Format* ]] && cmd_exist unrtf; then
614 if [[ "$PARSEHTML" = yes ]]; then
615 msg "append $sep to filename to view the RTF source"
616 istemp "unrtf --html" "$2" | parsehtml -
618 msg "append $sep to filename to view the RTF source"
619 istemp "unrtf --text" "$2" | sed -e "s/^### .*//" | fmt -s
621 elif [[ "$PARSEHTML" = yes && "$1" = *Excel\ document* ]] && cmd_exist xlhtml; then
622 msg "append $sep to filename to view the spreadsheet source"
623 xlhtml -te "$2" | parsehtml -
624 elif [[ "$PARSEHTML" = yes && "$1" = *PowerPoint\ document* ]] && cmd_exist ppthtml; then
625 msg "append $sep to filename to view the PowerPoint source"
626 ppthtml "$2" | parsehtml -
627 elif [[ "$PARSEHTML" = yes && ("$1" = *OpenDocument\ [CHMPST]* || "$1" = *OpenOffice\.org\ 1\.x\ [CIWdgpst]*) ]] && cmd_exist unzip; then
628 if cmd_exist o3tohtml; then
629 msg "append $sep to filename to view the OpenOffice or OpenDocument source"
630 istemp "unzip -avp" "$2" content.xml | o3tohtml | parsehtml -
631 elif cmd_exist sxw2txt; then
632 msg "append $sep to filename to view the OpenOffice or OpenDocument source"
635 msg "install at least sxw2txt from the lesspipe package to see plain text in openoffice documents"
637 elif [[ "$1" = *ISO\ 9660* ]] && cmd_exist isoinfo; then
638 if [[ "$2" != - ]]; then
639 msg "append $sep to filename to view the raw data"
641 joliet=`isoinfo -d -i "$2" | egrep '^Joliet'|cut -c1`
642 echo "================================= Content ======================================"
643 isoinfo -lR$joliet -i "$2"
645 elif [[ "$1" = *image\ data* || "$1" = *JPEG\ file* || "$1" = *JPG\ file* ]] && cmd_exist identify; then
646 msg "append $sep to filename to view the raw data"
647 identify -verbose "$2"
648 elif [[ "$1" = *MPEG\ *layer\ 3\ audio* || "$1" = *MPEG\ *layer\ III* || "$1" = *mp3\ file* || "$1" = *MP3* ]]; then
649 if cmd_exist id3v2; then
650 msg "append $sep to filename to view the raw data"
651 istemp "id3v2 -l" "$2"
652 elif cmd_exist mp3info2; then
653 msg "append $sep to filename to view the raw data"
655 elif cmd_exist mp3info; then
656 msg "append $sep to filename to view the raw data"
659 elif [[ "$1" = *perl\ Storable* ]]; then
660 msg "append $sep to filename to view the raw data"
661 perl -MStorable=retrieve -MData::Dumper -e '$Data::Dumper::Indent=1;print Dumper retrieve shift' "$2"
662 elif [[ "$1" = *UTF-8* && $LANG != *UTF-8 ]] && cmd_exist iconv; then
664 elif [[ "$1" = *ISO-8859* && $LANG != *ISO-8859-1 ]] && cmd_exist iconv; then
665 iconv -f ISO-8859-1 "$2"
666 elif [[ "$1" = *UTF-16* && $LANG != *UTF-16 ]] && cmd_exist iconv; then
668 elif [[ "$1" = *GPG\ encrypted\ data* ]] && cmd_exist gpg; then
669 msg "append $sep to filename to view the encrypted file"
671 elif [[ "$1" = *data* ]]; then
672 msg "append $sep to filename to view the raw data"
675 set "plain text" "$2"
677 if [[ "$1" = *plain\ text* ]]; then
678 if cmd_exist code2color; then
679 code2color $PPID ${in_file:+"$in_file"} "$2"
680 if [[ $? = 0 ]]; then
685 if [[ "$2" = - ]]; then
692 if [[ "$a" = "" ]]; then
693 if [[ "$0" != /* ]]; then
696 if [[ "$SHELL" = *csh ]]; then
697 echo "setenv LESSOPEN \"|$pat$0 %s\""
699 echo "LESSOPEN=\"|$pat$0 %s\""
700 echo "export LESSOPEN"
703 # check for pipes so that "less -f ... <(cmd) ..." works properly
704 [[ -p "$1" ]] && exit 1