LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Search for directories with the highest characters in their names (http://www.linuxquestions.org/questions/programming-9/search-for-directories-with-the-highest-characters-in-their-names-829188/)

Kenny_Strawn 08-29-2010 04:33 PM

Search for directories with the highest characters in their names
 
How do you tell a shell script to search for the directory within another directory (in this case /lib/modules) whose characters in its name (in this case numbers) are highest? I want to be able to tell mkinitramfs in a script to be able to see the highest possible kernel version in the /lib/modules directory.

Sergei Steshenko 08-29-2010 04:57 PM

Quote:

Originally Posted by Kenny_Strawn (Post 4081706)
How do you tell a shell script to search for the directory within another directory (in this case /lib/modules) whose characters in its name (in this case numbers) are highest? I want to be able to tell mkinitramfs in a script to be able to see the highest possible kernel version in the /lib/modules directory.

man ls
man sort
man head

- for starters.

Kenny_Strawn 08-29-2010 05:50 PM

Thread marked Solved:

Code:

ls /lib/modules | sort -g | head -n 1


All times are GMT -5. The time now is 07:06 AM.