LoginSignup
0
0

More than 5 years have passed since last update.

指定した文字列に一致する文字列を候補として表示するcompgenコマンド

Last updated at Posted at 2018-04-01

compgen

任意の文字列のリストや、ファイル名などから、 引数で指定した文字列に一致するものを候補として表示する。

-W

オプションで文字列のリストを指定し、 指定したリストから、引数で指定した文字列に前方一致する文字列を表示。

$ compgen -W "one two once twice" -- o
one
once
 
$ compgen -W "one two once twice" -- onc
once




-c



引数で指定した文字列に前方一致する実行ファイルを表示する。





$ compgen -c -- man
mandb
manpage-alert





-d



カレントディレクトリで引数に前方一致する。
ディレクトリを表示。





$ compgen -d -- e
etc





-f



カレントディレクトリで、引数に前方一致する。
ファイルとディレクトリを表示。





$ compgen -f -- e
etc





0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0