Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

Is there any software to do so?I do not want to reinvent the wheel.


share|improve this question
The effort sounds so short that it would not matter if you write it from scratch. – nik Nov 4 '09 at 10:13
Sorry for that,so you could think I'm just looking for that script. – Jichao Nov 4 '09 at 10:26
up vote 1 down vote accepted

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'
share|improve this answer
i think this will work for "README" "readme" and "read_me" but break on "Read Me". maybe find . -maxdepth 1 -iname '*read*me*' -print0 | xargs -0 less – quack quixote Nov 4 '09 at 10:33
and it may not get newlines properly - depends on how ls formats.. – warren Nov 4 '09 at 12:08
you're right, if it has a space it doesn't work – warren Nov 4 '09 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .