home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10570 < prev    next >
Encoding:
Text File  |  1992-08-31  |  1.6 KB  |  46 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!nucsrl!ddsw1!dattier
  3. From: dattier@ddsw1.mcs.com (David W. Tamkin)
  4. Subject: Re: A question on ls
  5. Message-ID: <1992Aug31.183110.2176@ddsw1.mcs.com>
  6. Organization: Contributor Account at ddsw1, Chicago, Illinois  60657
  7. References: <6786@tekig7.PEN.TEK.COM> <1992Aug29.233534.27967@umbc3.umbc.edu>
  8. Distribution: na
  9. Date: Mon, 31 Aug 1992 18:31:10 GMT
  10. X-Disclaimer:  Material posted in this article is the sole responsibility of
  11.                 the poster and does not represent MCSNet or the system owners.
  12. Lines: 32
  13.  
  14. rouben@math9.math.umbc.edu (Rouben Rostamian) wrote in
  15. <1992Aug29.233534.27967@umbc3.umbc.edu>:
  16.  
  17. | In article <6786@tekig7.PEN.TEK.COM> naren@tekig5.pen.tek.com (Naren Bala)
  18. | writes:
  19.  
  20. | >What command would I type to display all files that do not have a .Z 
  21. | >extension ?
  22.  
  23. | The wildcards are expanded by the shell, so the answer is: it depends on
  24. | the shell you are using.  In tcsh, you type:
  25. | % ls ^*.Z
  26. | In sh and csh you are out of luck.  In other shells, I don't know.
  27.  
  28. In ksh, ls -d !(*.Z) .!(*.Z)
  29.  
  30. In sh, you aren't very far out of luck:
  31.  
  32. ls -d `for i in .* *
  33. do
  34.   case $i in
  35.   *.Z|.*.Z) ;;
  36.   *) echo $i ;;
  37.   esac
  38. done`
  39.  
  40. The sh running here under Dell SVR4 doesn't consider initial periods special
  41. for pattern matching with "case", so *.Z) ;; is enough without |.*.Z, but
  42. your sh's mileage may very.
  43.  
  44. David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297
  45. dattier@ddsw1.mcs.com    CompuServe: 73720,1570    MCI Mail: 426-1818
  46.