Command-Line

-l 參數在 tcsh 中是什麼意思?

  • February 13, 2019

我正在執行一個 tcsh shell。

-l我對 中的選項有疑問set -l

當我查看 manset命令時,我看不到-l參數。

使用 tcsh shell 時,-l參數是什麼意思?

在哪里以及如何找到此資訊?

你看錯地方了。這是來自tcsh(1)手冊頁:

set
set name ...
set name=word ...
set [-r] [-f|-l] name=(wordlist) ... (+)
set name[index]=word ...
set -r (+)
set -r name ... (+)
set -r name=word ... (+)
    The  first  form  of  the command prints the value of all shell
    variables.  Variables which contain more  than  a  single  word
    print  as a parenthesized word list.  The second form sets name
    to the null string.  The third form sets  name  to  the  single
    word.   The  fourth  form  sets  name  to  the list of words in
    wordlist.  In all cases  the  value  is  command  and  filename
    expanded.   If -r is specified, the value is set read-only.  If
    -f or -l are specified, set only  unique  words  keeping  their
    order.  -f  prefers the first occurrence of a word, and -l the
    last.

所以set -f list=(foo bar baz foo)將設置list(foo bar baz),

set -l list=(foo bar baz foo)將設置list(bar baz foo),

並將set list=(foo bar baz foo)其設置為(foo bar baz foo),保持重複。

唯一的區別是它如何處理單詞列表中的重複項。此功能在 classic/real 中不存在csh,它現在是不受阻礙的開源本身,並且(如果我沒記錯的話)csh許多系統上的預設設置。

引用自:https://unix.stackexchange.com/questions/500459