Home » Questions » Computers [ Ask a new question ]

Automatically open README/readme/etc with less?

Automatically open README/readme/etc with less?

I come up with a solution to this problem,write a piece of script call readme who internal call the less with the current directory readme-alike txt file.

Asked by: Guest | Views: 326
Total answers/comments: 1
Guest [Entry]

"Do you mean you want to not have to know the filename specifically to open any given, case-insensitive 'readme' files?

Something like this perhaps (but it will fail on filenames with spaces):

alias readme='ls -1 | grep -i read | grep -i me | xargs less'

From @~Quack's comment, if you want to handle spaces, too:

alias readme='find . -maxdepth 1 -iname '*read*me*' -print0 | xargs -0 less'"