1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Linux / Unix Command: lsearch
Command Library


lsearch - See if a list contains a particular element  


lsearch ?mode? list pattern



This command searches the elements of list to see if one of them matches pattern. If so, the command returns the index of the first matching element. If not, the command returns -1. The mode argument indicates how the elements of the list are to be matched against pattern and it must have one of the following values:

The list element must contain exactly the same string as pattern.
Pattern is a glob-style pattern which is matched against each list element using the same rules as the string match command.
Pattern is treated as a regular expression and matched against each list element using the rules described in the re_syntax reference page.

If mode is omitted then it defaults to -glob.



list, match, pattern, regular expression, search, string

Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux/Unix Command Library

>> Shell Command Library

Explore Linux
By Category
    linuxLinuxcomputeTechb0502bb1540001006c84963cb0502bb1540002006c818e0ahttp://linux.about.comod526F6F74132058liveGary Newelllinuxguide3TO004KpzNIP11970-01-0110/od/index.htm0526F6F741approved/od
  1. About.com
  2. Tech
  3. Linux

©2016 About.com. All rights reserved.