LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sort in .bashrc (https://www.linuxquestions.org/questions/linux-newbie-8/sort-in-bashrc-298392/)

Kanon 03-06-2005 02:21 PM

Sort in .bashrc
 
Im trying to setup .bashrc so I can put it in skel. But first I want to have it so "normal" ppl (aka windows users) can read the out put. So what I was thinking is to set it up so it lists this in order, dir then files. But also alphabeticaly.

So far I can do either ls -la (then I got sort) or ls -Ula (then I got dirs first, unsorted).
I did check the man pages. Could not figure out who to accomplish this, so Im asking here... :)

Any one care to give me a hint? Thanks!

Dark_Helmet 03-06-2005 03:24 PM

I don't know of any option to accomplish what you're shooting for. This might do what you need:
Code:

alias dir='ls -lA | grep "^d" | sort -k 9; ls -lA | grep -v "^d" | grep -v "^total" | sort -k 9'
There may be other, more efficient ways of doing it.

Kanon 03-07-2005 02:40 AM

Yeah! That works! :)
Thanks!!!

Edit: How do I get the colors to work with this?

Dark_Helmet 03-07-2005 11:51 AM

I'm not sure that you can. The output of "ls" is being fed through other commands, and they are likely stripping off the special character sequences that denote color changes.

Kanon 03-07-2005 12:56 PM

Its looking good anyhow! Thanks alot!


All times are GMT -5. The time now is 08:12 PM.