From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,88c90debff9112c0 X-Google-Attributes: gidfa528,public From: ccam@spiral2.its.latrobe.edu.au (Andrew Moar) Subject: Re: Need a UNIX expert to create a new UNIX command Date: 2000/06/07 Message-ID: <8hkgmh$dtc$1@news.latrobe.edu.au>#1/1 X-Deja-AN: 632008845 References: <8his5s$ing$1@miranda.gmrc.gecm.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.latrobe.edu.au X-Trace: news.latrobe.edu.au 960349713 14252 131.172.12.60 (7 Jun 2000 03:48:33 GMT) Organization: La Trobe University Mime-Version: 1.0 NNTP-Posting-Date: 7 Jun 2000 03:48:33 GMT Newsgroups: comp.unix.tru64 In article <8his5s$ing$1@miranda.gmrc.gecm.com>, jxb@unconfigured.xvnews.domain (Jocelyn Burget) writes: > I'd like to create a command, let's call it "diskfull", that does > exactly the same thing as du but the output will be in my own format. > > Example: > > [nautilus:jxb] 11% diskfull -M filename > Result: The reported occupied space is in Mbytes > > OR > > [nautilus:jxb] 11% diskfull -G filename > Result: The reported occupied space is in Gbytes How about something like: #!/bin/sh if [ "$1" = "-M" ] then du -k $2 | awk '{print ($1 / 1024) " " $2}' else du -k $2 | awk '{print ($1 / 1048576) " " $2}' fi or something along those lines... Cheers, Andrew -- Andrew Moar : Ph +61 3 9479 1505 email A.Moar@latrobe.edu.au Unix Environment Specialist, Information Technology Services La Trobe University, Bundoora