0

Bash has some special or predefined variables, such as $? and $#.

How to know the meaning of those variables use build in command instead of searching online web pages?

I have try to use this:

help variables

But it didn't show those variables.

1
  • 1
    man -P cat bash >bash.txt then search this file for the special strings you are looking for. It is a little easier than going back and forth in the man bash output using less navigation capabilities. Also you can use grep etc. on the file
    – MelBurslan
    Commented Mar 16, 2016 at 15:35

3 Answers 3

2

You can use the bash man page. Open it with man bash. Normally this is displayed by less (you can also read the man page for less with man less).

In less you can scroll down with j, up with k, quit with q and open a search prompt with /. The section you want to search for is "Special Parameters".

1

You can use the bash info page. Open it with info bash. Note that some systems don't have the GNU info documentation system, or the info documentation for bash pre-installed, you may have to install a package for that.

In info, you can query the index of topics with i (completion is available). For instance, if you enter $#, you'll be taken directly to the definition of the $# variable.

To learn more about how to use info, try info info.

1

Just execute this line:

LESS=+/'^ *Special Parameters' man bash
1
  • Learned a new way to use $LESS, thanks :)
    – Lucas
    Commented Mar 18, 2016 at 8:36

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.