Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


LinkBack Search this Thread
Old 01-24-2008, 05:56 AM   #1
Registered: Sep 2006
Posts: 57

Rep: Reputation: 15
create a shell script to do simple man lookup

I can do this command in linux shell:
man -p $MYAPP_HOME/man WhateverIWantToSearchString
But I just don't want to keep typing. I want to have a shell script that would be called and then I can just pass the "WhateverIWantToSearchString".

So it would be:
myman WhateverIWantToSearchString
Can someone give me an insight into this?

Old 01-24-2008, 06:06 AM   #2
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 129Reputation: 129
Why don't you just put those man files in with the rest? Or else put all those man files in a single man folder in your home directory and include it in a manpath set in your .bash_profile ?
Old 01-24-2008, 09:04 AM   #3
Registered: Sep 2006
Posts: 57

Original Poster
Rep: Reputation: 15
having separate myman script, prevents man page conflicts. How do you write a simple script the take command arguments and append it? This should be one liner.
Old 01-24-2008, 09:22 AM   #4
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Rep: Reputation: 15
This is what you are looking for I believe;

# "myman" script



man $mypath/$myfile

Or something quite similar.
Old 01-24-2008, 09:25 AM   #5
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Rep: Reputation: 15
I forgot to mention, once the little script is written, you must ensure it has execute priviledges and accessible from your system PATH, unless your are ready to specify the path to it each time...


myman <file to view>

NOTE: You do NOT have to specify the PATH to the file, as it is defined by the mpath, or whatever you name it variable... Just type if the file you want to view, and voila, it's there...

Old 01-24-2008, 09:51 AM   #6
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 292

Rep: Reputation: 46
You are probably rather looking for something like


man -p $MYAPP_HOME/man "$@"
But for something as simple as this, an alias is probably the better solution (add the definition to your ~/.bashrc or ~/.bash_aliases or somesuch):
alias myman='man -p $MYAPP_HOME/man'


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help getting started simple simple shell script dhonnoll78 Programming 6 12-17-2007 05:34 PM
simple shell script sycamorex Linux - Newbie 2 03-16-2006 06:00 PM
Simple shell script mikz Linux - General 1 02-24-2005 07:18 AM
a simple shell script Warchief Programming 1 07-31-2003 05:01 AM
Simple C Shell script is not so simple elconde Programming 2 09-16-2001 11:53 PM

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration