$
私はちょうどlessで始まる検索パターンを渡してみました。
less +/'\$l' myfile.pl
わかりました。
There is no -l option ("less --help" for help)
ドキュメントを読んだ後、代替-p
オプションを試しました。
less -p'\$l' myfile.pl
同じエラーが発生しました。
それから発見しました。 (後のスペースに注意してください-p
。)
less -p '\$l' myfile.pl
動作します。つまり、エラーメッセージなしでファイルを開き、最初の項目に移動します$l
。
長いオプションバリアントが--pattern=$l
機能しない
less --pattern='\$l' myfile.pl
There is no -l option ("less --help" for help)
=
そして仕事よりスペース
less --pattern '\$l' myfile.pl
これは
less -V
less 458 (POSIX regular expressions)
Copyright (C) 1984-2012 Mark Nudelman
openSUSE Leap 42.3から
今質問はこれがバグですか?
ベストアンサー1
からman less
:
--use-backslash This option changes the interpretations of options which follow this one. After the --use-backslash option, any backslash in an option string is removed and the following character is taken literally. This allows a dollar sign to be included in option strings.
その後、バックスラッシュとドルを避ける必要があります。
less --use-backslash +'/\\\$l' myfile.pl