If I'm reading that right, you're trying to get a list of your top 20 largest folders? What does 'watch' do?
On Tue, Sep 17, 2013 at 9:47 AM, Martin Bähr <[email protected]> wrote: > hi, > > i am trying to convert the following watch command to fish: > > watch "(for i in *; do du -h \"\$i\"; done| tail -20 | cut -c > -\$((\$COLUMNS-5)))" > > actually, the problem i really wanted to solve is to change the order in > which the files are processed. bash expands * alphabetically, and > because the filenames contain spaces, i can't use > > for i in `ls -tr`... > > however that works in fish: > for i in (ls -tr); du -sh $i; end | tail -20 | cut -c -(math $COLUMNS - 5) > > but now i can't wrap that with watch, because watch executes its > argument with sh. > > a workaround is a simple loop: > while true; > clear; > for i in (ls -tr); > du -sh $i; > end | tail -20 | cut -c -(math $COLUMNS - 5); > sleep 2; > end > > unfortunately the clear; command causes an annoying flicker. > > ansi escape-sequences help: > > clear; > while true; > echo \e\[H; > for i in (ls -tr); > du -sh $i; > end | tail -20 | cut -c -(math $COLUMNS - 5); > sleep 2; > end > > but only as long as each line fills the screen. > > i am going with this for now as it is good enough for my needs, > but i am wondering if this can be improved... > > greetings, martin. > -- > eKita - the online platform for your entire academic life > hackerspace beijing - http://qike.info > -- > chief engineer eKita.co > pike programmer pike.lysator.liu.se caudium.net > foresight developer realss.com foresightlinux.org > unix sysadmin trainer developer societyserver.org > Martin Bähr working in china http://societyserver.org/mbaehr/ > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > Fish-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/fish-users ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
