MAN page from openSUSE Leap 42 smenu-0.9.13-1.1.x86_64.rpm


Section: User Commands (1)
Updated: 2015


smenu - filter that allows one to interactively select a word from stdinand outputs the selection to stdout. 


smenu [-h|-?] [-f configuration_file] \      [-n lines] [-t [cols]] [-k] \      [-s pattern] [-m message] [-w] \      [-d] [-M] [-c] [-l] [-r] [-b] \      [-a (i|e|c|b|s|t|ct|sf|st|da):ATTR]... \      [-i regex] [-e regex] \      [-C [i|e]<col selectors>] \      [-R [i|e]<row selectors>] \      [-S /regex/string/[g][v][s][i]] \      [-I /regex/string/[g][v][s][i]] \      [-E /regex/string/[g][v][s][i]] \      [-A regex] [-Z regex] \      [-N [regex]] [-U [regex]] [-F] [-D sub-option...] \      [-1 regex [ATTR]] [-2 regex [ATTR]] ... [-5 regex [ATTR]] \      [-g [string]] [-q] [-W bytes] [-L bytes] \      [-T [separator]] [-P [separator]] [-p] \      [-V] [-x|-X type [word] delay] \      [input_file]      <col selectors> ::= col1[-col2],...|<RE>,...      <row selectors> ::= col1[-col2],...|<RE>,...      <sub-option>    ::= [l|r:<char>]|[a:left|right]|[p:included|all|                          [w:<num>]|[f:yes|no]|[o:<num>]|[n:<num>]|                          [i:<num>][d:<char>]      <ATTR>          ::= [fg][/bg][,style]      <RE>            ::= <char>regex<char>      <col/row selectors> and <RE> can be freely mixed.      The parameters of -a and -D must be delimited by blanks.


This small utility acts as a filter when no input file is given(reads from stdin and writes to stdout) or takes its inputs from that file.

All read words are presented in a scrolling window on the terminalat the current cursor position without clearing the screen before.

The selection cursor is initially positioned on the first selectable wordby default.

Options exists to explicitly or implicitly include or exclude some words byusing extended regular expressions.

Notice that when some words are explicitly excluded they can no more bere-included after.

Excluded words are skipped when the selection cursor is moved and cannotbe searched for.

The -W option can be used to set the characters (or multibytesequences) which will be used to delimit the input words.The default delimiters are: SPACE, \t and \n.

The -L has a similar meaning for lines.

Special character sequences formed by a \ followed by one of thecharacters a b t n v f r and\ are understood and have their traditional meanings.

UTF-8 sequences introduced by \u are also understood.\u can be followed by 2,4,6 or 8 hexadecimal characters.An invalid UTF-8 sequence will be replaced by a dot (.), seealso below.

Example: \uc3a9 means latin small letter e with acute.

Note that with most shells, the \ before the u need to beprotected or escaped.

Quotations (single and double) in the input stream can be used to ignorethe word separators so that a group of words are taken as a single entity.

Non printable characters in words that are not delimiters areconverted to their traditional form (\n for end-of-line,\t for tabulation...) by default.A single dot (.) is also used as a placeholder otherwise.

Words containing only spaces, entered directly or resulting from asubstitution, are also rejected unless they are not selectable.This allows special effects like creating blank lines for example.These words are also kept in column mode, selectable or not.

Warning, UTF-8 encoded codepoints are quietly convertedinto dots (.) when the user locale is not UTF-8 aware likePOSIX or C by example.


Moving among words

The cursor can be moved in every direction by using thekeyboard arrow keys (<-,da,ua,->)or the vi direction keys (h, j, k and l).HOME, END, PgDn and PgUp can also be used,if available, and have the following meanings:
<-, hPrevious word
ua, kPrevious line
PgUp, KPrevious pages
HomeFirst word of the window
CTRL+Home, SHIFT+Home, CTRL+kFirst word
->, lNext Word
da, jNext line
PgDn, JNext pages
EndLast word of the window
CTRL+End, SHIFT+End, CTRL+jLast word

If the -N, -U or -F are used then it is possible todirectly access a word by entering its number.The numbering created using these option is done before any wordssubstitution done using -S, -I or -E.

Using a combination of these options, it is easy to control which wordswill be numbered by adding a special symbol in it before using smenu andremoving it (substituted by nothing) afterward using -I by example.

-E gives another way to do that, see below or more. 

Searching for a word

The key / or the key combination ^F (CTRL+f) can beused to initiate a search by prefix among the words (possibly alteredby -S/-I/-E) located after the cursor.

After that, the cursor attributes are modified and all the charactersentered up to a default of 6s after this change are put in a search bufferand the cursor moves immediately to the next word matching this prefix.

Any character entered before a default of 6s timeout after this actioncompletes this buffer and resets the 6s timer and advances the cursoragain if another word matches the new buffer.

As soon as the timer expires, the search mode is ended and the cursorregains its initial appearance.

The search buffer is persistent as long as the cursor is on a matchingword when a new search is initialized.

If the cursor is moved in this mode, the timer will expire immediatelyAs if ENTER or ESC was pressed and the move is attempted.

Pressing ENTER or ESC immediately exits this mode.

Pressing SPACE or n repeats the last search if the searchbuffer is not empty.Nothing will happen if there is no matching word after the cursor.

Note that the SPACE and n keys cannot be used when the searchmode is active because they must be available if you want to search aword containing these characters. 

Selection and Exit

Pressing q gives the possibility to exit without selecting anything.

By default, ENTER writes the selected word to stdout when not insearch mode otherwise it exits from this mode and does nothing more.If you want to be able to select a word even when in search mode,use the -r option to change this behavior. 


A small help message can be displayed when hitting ?.This display will last for 10s or until a valid key or ESC ispressed. 

Scroll bar

A scroll bar is displayed at the right of the scrolling window.Its appearance is meant to be classical but it has some particularities:
The scroll bar is not displayed if all the input words fit on only oneline.
Otherwise, the scroll bar is always displayed except when the -qoption is set.This option completely disables the scroll bar display.
When the scrolling window has only one line, the scroll bar has only 3states:
v when on all but the last line, indicating that you can go downto see more.
^ when on the last line.
| otherwise.
When there is more than one line to display, / means that the windowdisplays the first line, \ the last line.| is used to fill the gap, see below the different possibleconfigurations.
\@\@^^\ Do not remove this trailing space!

A + can also appear in the scroll bar in lieu of the vertical bar,giving the relative position of the cursor line in the bunch of inputwords. 

Terminal resizing (also see BUGS/LIMITATIONS)

The windows is redrawn if the terminal is resized.The redrawing is actually done only 1s after the end of the resizing toavoid artefacts on screen.The cursor will remain on the current selected word but may be displayedat another place in the window. 

Unicode support

This utility is Unicode aware and should be able to display correctlyany Unicode character (even double-width ones) as long as the currentencoding is UTF-8 (UTF-8 in the output of the localecommand). 


If a file with adequate permissions and the same name as the executablebut prefixed with a dot is present in the current directoryor in the user's home directory, then it will be parsed as aini file.The values read from the file in the home directory will be overridden bythe ones read from the local directory (if it is present).

Missing and bad keywords are silently skipped.

The values read, if valid, override the default hard-coded ones.

If a value is invalid an error message is shown and the program terminates.

The values of the timers must be given in units of 1/10 of a second.

Here is an example giving the syntax and the names of the keywordsallowed:

--8<------------------------------------------------------------------[colors]  ; The terminal must have at least 8 colors and/or have attributes like bold  ; and reverse for this to be useful  ; if not the following settings will be ignored.  method=ansi             ; classic | ansi (default)  cursor=0/2              ; cursor attributes  cursor_on_tag=0/2,u     ; cursor on tag attributes  shift=6,b               ; shift symbol attributes  bar = 7/4,b             ; scroll bar attributes  search_field = 0/6      ; search field attributes  search_text = 7,bu      ; search text attributes  ; include = b           ; selectable color attributes  exclude = 4/0,u         ; non-selectable color attributes  tag = 0/5               ; tagged (selected) attributes  dacess = 3,b            ; direct access tag attributes  special1 = 7/4,b        ; attributes for the special level 1  special2 = bu           ; attributes for the special level 2  special3 = /3,b         ; attributes for the special level 3  special4 = 7/4          ; attributes for the special level 4  special5 = 7/2,b        ; attributes for the special level 5[window]  lines = 7               ; default number of lines of the window[limits]  word_length = 1024      ; arbitrary max length of input words (int)  words = 32767           ; arbitrary max number of allowed input                          ; words (int)  columns = 128           ; arbitrary max number of columns (int)[timers]  search = 60             ; search timers in 1/10 s  help = 150              ; duration of the help message in 1/10 s  window = 7              ; delay before redrawing if the size of the                          ; terminal's window change in 1/10 s  direct_access = 6       ; duration allowed to add a new digit to                          ; the direct word access number in 1/10 s--8<------------------------------------------------------------------
The method keyword can take the two possible values displayedabove and determines if you want to use the native method (limited to 8colors) of the ansi method (ISO 8613-6) if your terminal supportsmore than 8 colors.

The default value corresponds to ansi.

The attributes syntax is [fg][/bg][,toggles] where fg andbg are numbers representing the foreground and backgroundcolor and toggles is a strings which can contain the charactersb, d, r, s, u and i standing forbold, dim, reverse, standout, underlineand italic.

Spaces are allowed anywhere in the lines and between them, even aroundthe =.
Everything following a ; is ignored.
When undefined, the default limits are:


-h or -?
Displays a long (-h) or short (-?) help message and exits.
-f configuration_file
This option gives the possibility to select an alternative configurationfile. If the given file doesn't exist or is not readable then thedefault values will be used.

The .smenu files in the user's home directory and in the currentdirectory, if present, will be ignored when this option is used.

-n lines
Gives the maximum number of lines in the scrolling selection window.By default five lines at most are displayed and the other ones, ifany, need you to scroll the window.
-t [columns]
This option sets the tabulation mode and, if a number is specified,attents to set the number of displayed columns to that number.In this mode, embedded line separators are ignored.The options -A and -Z can nevertheless be used to force wordsto appear in the first (respectively last) position of the displayed line.

Note that the number of requested columns will be automatically reducedif a word does not fit in the calculated column size.

In this mode each column has the same width.

By default, the spaces surrounding the output string will be deleted.This option forces them to be retained.Note that these spaces must have been protected to be selected.
-s pattern
Place the cursor on the first word corresponding to the specified pattern.

pattern can be:

A # immediately followed by a number giving the initialposition of the cursor (counting from 0).

If the word at this position is excluded, then the first previous nonexcluded word is selected if it exists, otherwise the first non excludedword is selected.

If this number if greater than the number of words, the cursor will beset on the latest selectable position.

A single # or the string #last to set the initialcursor position to the latest selectable word position.
A string starting with a / indicating that we want the cursorto be set to the first word matching the given regular expression.
A prefix string indicating that we want the cursor to be set on thefirst word matching the string given (a will match Cancelby example).

Warning, when searching for a prefix or a regular expression, smenuonly looks for them after an eventual modification, so for example,the command:smenu -I/c/x/ -s/c <<< "a b c d" won't find c and put the cursoron a but smenu -I/c/x/v -s/c <<< "a b c d" will find it andput the cursor on the x substituting the c on screen only

\u sequences can be used in the pattern.

-m message
Displays a message above the window.If the current locale is not UTF-8, then all UTF-8 charactersin it will be converted into a dot.

\u sequences can be used in the message.

Note that the message will be truncated if it does not fit on a terminalline.

When -t is followed by a number of columns, the default is tocompact the columns so that they use the less terminal width aspossible.This option enlarges the columns in order to use the whole terminal width.

When in column mode, -w can be used to force all the columns tohave the same size (the largest one).See option -c below.

Note that the column's size is only calculated once when the words aredisplayed for the first time.A terminal resize will not update this value.This choice enables a faster display.

Tells the program to clean up the display before quitting by removingthe selection window after use as if it was never displayed.
Centers the display if possible.
Sets the column mode.In this mode the lines of words do not wrap when the right border ofthe terminal is reached but only when a special character is read.Some words will not be displayed without an horizontal scrolling.

If such a scrolling is needed, some indications may appear on the leftand right edge of the window to help the user to reach the unseen words.

In this mode, the width of each column is minimal to keep the maximuminformation visible on the terminal.

Sets the line mode.This mode is the same as column mode but without any column alignment.
Enables ENTER to validate the selection even in search mode.
Replaces all non-printable characters by a blank.If this results in a blank word, it will be potentially deleted.
Sets the display attributes of the elements displayed and the cursor.

At least one attribute prefixed attribute must be given.

PREFIX can take the following values:

included words.
excluded words.
scroll bar.
shift indicator.
tagged words.
cursor on tagged words.
search field.
search buffered text.
direct access tag.

If more than one attribute is given, then they must be separated byspaces.

See the -1 option for the ATTR syntax.

-i regex
Sets the include filter to match the selectable words.All the other words will become implicitly non-selectable (excluded)

-i can be used more than once with cumulative effect.

\u sequences can also be used in the regexp.

-e regex
Sets the exclude filter to match the non-selectable words.All the other selectable words will become implicitly selectable (included)

-e can be used more than once with cumulative effect.This filter has a higher priority than the include filter.

The regex selections made using -i and/or -e are donebefore the possible words alterations made by -I or -E(see below).

\u sequences can also be used in the regexp.

-C [i|e] <col selectors>

These letters are case independent so I can be used in place ofi per example.

In column mode, this option allows one to restrict the previousselections or de-selections to some columns.If no selection is given via -i and -e this option gives thepossibility to select entire columns by giving their numbers (1 based)of extended regular expressions.

i or nothing select the specified ranges of columns.e select all but the specified ranges of columns.

The words in the selected columns will be considered as includedAnd the others excluded.

A selection by regular expressions means that a column containing a wordmatching one of these expression will be included or excluded accordingto the letter given after the option.

Regular expressions and column numbers can be freely mixed.

Regular expression in -C and -R can contain UTF-8characters either directly or by using the \u notation.

Example of columns selection: -Ci2,3,/X./,5-7 forces the cursorto only navigate in columns 2,3,5,6 and 7and those containing a two characters word starting with 'X'.If e was used in place of i, all the columns would have beenselected except the columns 2,3,5,6,7and those matching the extended regular expression 'X.'.

Spaces are allowed in the selection string if they are protected.

The column mode is forced when this option is selected.

-R [i|e] <row selectors>
Similar to -C but for the rows.

One difference though: this is the line mode which is forced by thisoption NOT the column mode.

-C and -R can be used more than once in a cumulative manner:The selection mode (selection or de-selection) is given by the firstoccurrence of the options, the other occurrences will only update theselected or de-selected ranges.

-S /regex/replacement string/[g][v][s]
Post-processes the words by applying a regular expression basedsubstitution.The argument must be formatted as in the sed editor.

This option can be used more than once.Each substitution will be applied in sequence on each word.This sequence can be stopped if a stop flag is encountered.

The optional trailing g (for global) means that all matchedoccurrences shall be replaced and not only the first one.
The optional trailing v (for visual) means that the alteredwords will only be used for display and search.The modifications will not be reflected in the returned word.
The optional trailing s (for stop) means that no moresubstitution will be allowed on this word even if another -S isused.
The optional trailing i (for ignore case) means that thestring search operation should ignore the case for this pattern.

Small example:R=$(echo a b c | smenu -S /b/B/)will display "a B c" and R will contain B if B isselected meanwhileR=$(echo a b c | smenu -S /b/B/v)will display the same as above but R will contain the originalword b if B is selected.In both cases, only the word B will be searchable and not b.

-I /regex/replacement string/[g][v][s]
Post-processes the selectable words by applying a regularexpression based substitution (see -S for details).
-E /regex/replacement string/[g][v][s]
Post-processes the excluded (or non-selectable) words byapplying a regular expression based substitution (see -S fordetails).

The / separator that -I and -E are using above can besubstituted by any other character except SPACE, \t,\f, \n, \r and \v.

In the three previous options, regex is a POSIXExtended Regular Expression.For details, please refer to the regex manual page.

Additionally \u sequences can also be used in the regexp.

If a post-processing action (-S/-I/-E) results in anempty (length 0) word, then we have two cases:
in column mode:
Substitutions involving empty words can lead to misalignments, so it isnecessary to prohibit them and terminate the program.These substitutions have to be made with other tools before using thisutility.
The word is simply removed.
-A regex
In column mode, forces all words matching the given regular expressionto be the first one in the displayed line.If you want to only rely on this method to build the lines, just specifyan empty regex to set the end-of-line separator with -L '')

\u sequences can also be used in the regexp after -A.
-Z regex
Similar to -A but forces the word to be the latest of its line.The same trick with -L can also be used.

\u sequences can also be used in the regexp after -Z.
-N [regex]
This option allows one to number the selectable words matching aspecific regular expression.These numbers are numbered starting from 1 and provides a direct accessto the words.

To use this functionality, the user must enter the number whichcorresponds to the desired entry digit per digit.

Each new digit must be added in a time frame of 1/2 seconds (per default)otherwise the number is considered complete and a newly entered digitwill start a new number.If the number does not exists, then the cursor is restored to it'sinitial position.

The sub-options of the -D option described below can change theway -N sets and formats the numbers.

This option can be used more than once with cumulative effects.

-N, -U and -F can be mixed.

-U [regex]
This option allows one to un-number words.If placed after a previous -N, it can be used to remove thenumbering of selected words.If placed before, the word which doesn't match its regular expressionwill be numbered by default.

This mechanism is similar to to the inclusion/exclusion of words by-i and -e.

This option can be used more than once with cumulative effects.

-U, -N and -F can be mixed.

This option is similar to -N but does not generate a continuousflow of numbers but extracts them from the word itself.

With this option you can take full control of the numbering of thedisplayed word.Note that the numbering does not need to be ordered.

The resulting word after the extraction of the number must be non empty.

Some sub-option are required, see the -D option described below.

Notice that for this option to work correctly, all the embeddednumbers must have the same number of digits.To get that, a preprocessing may be necessary on the words before usingthis program.

-F, -N and -U can be mixed.

-D [parameters]
This option allows one to change the default behaviour of the -N,-U and -F options.

Its optional parameters are called sub-options and must respect theformat x:y where x can be:

l (-F, -N and -U options)
Here y is the UTF-8 character (in native or \u form)to print before the number. The default is a single space.
r (-F, -N and -U options)
Here y is the UTF-8 character (in native or \u form)to print after the number. The default is ).
a (-F, -N and -U options)
Here y is 'left' (or one of its prefixes) if the numbermust be left aligned, or 'right' (or one of its prefixes)if it must be right aligned. The default is right.
p (-F, -N and -U options)
Here y is 'included' (or one of its prefixes) or 'all' (or one of its prefixes) for the initial padding ofthe non numbered words. 'included' means that only includedword will be padded while 'all' means pad all words. Thedefault is all.
w (-F, -N and -U options)
Here y is the width of the number between 1 and 5 included.
f (-F, -N and -U options)
Here y controls if the numbering must follow the lastextracted number (defaults to yes) or if it must remainindependent.
o (-F option)
Here y is the offset of the first multibyte character ofthe number to extract from the word (defaults to 0).
n (-F option)
Here y is the number of multibyte characters to extractfrom the word starting at the offset given by the o sub-option.
i (-F option)
Here y is number of multibyte characters to ignore afterthe extracted number
d (-F, -N and -U options)
Here y is a multibyte separator.When present, this directive instructs smenu to output the selectednumbered word(s) prefixed by its(their) direct access number(s)and the given separator.

Only the numbered word(s) will be prefixed.

d stands for decorate.

This directive can be useful when you want to post-process the outputaccording to its direct access number.Example: r:\> l:\< a:l d:_

To number all words with the default parameters, use thesyntax: "-N ." which is a shortcut for:"-N . l:' ' r:')' a:r p:a"

The padding sub-option specifies whether spaces must also beadded in front of excluded words or not to improve compactness.

When the w sub-option is not given the width of the numbers isdetermined automatically but if -F is set and the value of then sub-option is given then this value is used.

-1 ... -5 regex [ATTR]
Allows one to give a special display color to up to 5 classes of wordsspecified by regular expressions.They are called special levels.Only selectable words will be considered.

By default, the 5 special levels have their foreground color set tored, green, brown/yellow, purple and cyan.All these colors also can be set or modified permanently in theconfiguration files.See the example file above for an example.

The optional second argument (ATTR) can be used to override thedefault or configured attributes of each class.Its syntax is the same as the one used in the configuration file:

[fg][/bg][,{b|d|r|s|u|i}] | [{b|d|r|s|u|i}]

Examples of possible attributes are:

  2/0,bu green on black bold underline  /2     green background  5      text in purple  rb     reverse bold

\u sequences can be used in the pattern.

-g [string]
Replaces the blank after each words in column or tabular mode by a columnseparator.

This separator is extracted from the string argument and eachof its (multibyte) character is used one after the other to fillthe gutter.

If there are more columns that gutter characters then the last characteris used for the remaining columns.

When not given, the separator defaults to a vertical bar | (or afull height vertical bar if the locale is set to UTF-8).

Each character can be given in normal or \u form in thestring argument.

Example: "|- " will allow one to separate the first two columnswith '|', then '-' will be used and ' ' willseparate the remaining columns if any.

Prevents the display of the scroll bar.
-W bytes
This option can be used to specify the characters (or multibytesequences) which will be used to delimit the input words.

Multibyte sequences (UTF-8) can be natives of using the same ASCIIrepresentation used in words (a leading \u following by up to 8hexadecimal characters).

Non-printable characters in arguments should be given using the standard$'' representation.$'\t' stands for the tabulation character for example.

The default delimiters are: SPACE, $'\t' and $'\n'.

-L bytes
This option can be used to specify the characters (or multibytesequences) which will be used to delimit the lines in the input stream.

Multibyte sequences (UTF-8) can be natives of using the same ASCIIrepresentation used in words (a leading \u following by up to 8hexadecimal characters).

Non-printable characters in arguments should be given using the standard$'' representation.$'\n' stands for the newline character for example.

The default delimiter is: $'\n'.

This option is only useful when the -c or -l option is alsoset.

The characters (or multibyte sequences) passed to -L areautomatically added to the list of word delimiters as if -W wasalso used.

\u sequences can also be used here.

-T [separator]
Enables the multi-selections or tag mode.In this mode, several selectable words can be selected without leavingthe program.

The current word can be automatically tagged when the ENTER keyis pressed to complete the selection process if the -p option isalso set or if no word has been tagged.

All the tagged words (and possibly the world under the cursor) willbe sent to stdout separated by the optional argument given after theoption -T.

Note than this separator can have more than one character, containUTF-8 characters (in native or \u form) and can even containcontrol character as in $'\n'.

A space is used as the default separator if none is given.

Caution: To get exactly the same behavior as in version 0.9.11and earlier, you must also use the -p option.

-P [separator]
Works like -T but, unlike -T, the output depends on the orderin which the words were tagged. In other words, the first tagged wordcomes first in the output, the second tagged word comes next, and soon.-P stands for "Pin".
This option modifies the default behavior of the -T and -Poptions.An untagged word under the cursor will be automatically tagged whenENTER is pressed.
Displays the current version and quits.
-x type [word] delay
-X type [word] delaySets a timeout.Three types of timeout are possible:
At the timeout, the word under the cursor and/or the tagged words aresent to the standard output if the ENTER key has been pressed
At the timeout, nothing is selected as if the q key has been pressed
At the timeout, the word given after the type is selected. Note that thisword doesn't need to be part of the words coming from the standard input.

Each type can be be shortened as a prefix of the full name ("cur" for"current" of "q" for "quit" per example).

The delay must be set in seconds and cannot be above 99999 seconds.

The remaining time (in seconds) is added at the end of the messagedisplayed above the selection window and is updated in real time eachsecond.

Each key press except ENTER, q, Q and ^C resetsthe timer to its initial value.

The -X version works like -x but no periodic remainingmessages is displayed above the selection window.



If tabulators (\t) are embedded in the input, there is no wayto replace them with the original number of spaces.In this case use another filter (like expand) to pre-processthe data. 




Simple Yes/No/Cancel request with "No" as default choice:

In bash:  read R <<< $(echo "Yes No Cancel" \               | smenu  -d -m "Please choose:" -s /N)or  R=$(echo "Yes No Cancel" \      | smenu -d -m "Please choose:" -s /N)In ksh:  print "Yes No Cancel"                \  | smenu -d -m "Please choose:" -s /N \  | read R


Get a 3 columns report about VM statistics for the current process inbash/ksh on Linux:

R=$(grep Vm /proc/$$/status | expand | smenu -b -W$'\n' -t3 -g -d)


Create a one column selection window containing the list of the first20 LVM physical volumes.At the end, the selection window will be erased.This example is written in ksh).

pvs -a -o pv_name --noheadings                 \| smenu -m "PV list" -n20 -t1 -d -s //dev/root \| read R

The display will have a look similar to the following with the cursorset on the word /dev/root:

PV list/dev/md126           \/dev/md127           |/dev/root            | <- cursor here./dev/sda2            |/dev/sdb2            |/dev/sdc1            |/dev/sdc2            |/dev/system/homevol  /

4 (advanced)

Imagine a file named sample.mnu with the following content:

--8<---------------------------------"1 First Entry" "3 Third entry""2 Second entry" "4 Fourth entry"@@@ "5 Fifth entry"@@@"0 Exit menu"--8<---------------------------------

Then this quite esoteric command will render it (centered on the screen) as:

+----------------------------------+|            Test menu             ||                                  || 1) First Entry   3) Third entry  || 2) Second entry  4) Fourth entry ||                  5) Fifth entry  ||                                  || 0) Exit menu                     |+----------------------------------+

with the cursor on Quit and only the numbers and "Quit" selectable.

R=$(smenu R=$(./smenu -q -d -s/Exit -M -n 30 -c \
                      -e "@+" -E '/@+/ /'            \
                      -F -D n:1 i:1                  \
                      -m "Test menu"$' < sample.mnu)

The selected entry will be available in R

Try to understand it as an exercise. 


NO_COLOR: force a monochrome terminal when set. 


Some terminal emulators, those notably based on VTE version later than0.35 (see, have a new featurethat gives them the possibility to wrap/unwrap already displayed lineswhen resizing the window.

As far as I known, there is no terminfo entry to disable that.

On these types of terminals, the automatic re-display of the output ofsmenu will be disturbed and some artifacts may appear on the screen ifthe terminal window is resized. 


© 2015 Pierre Gentile (



Moving among words
Searching for a word
Selection and Exit
Scroll bar
Terminal resizing (also see BUGS/LIMITATIONS)
Unicode support
4 (advanced)

This document was created byman2html,using the manual pages.