0

I'm running a tcsh shell.

I have questions about the -l option in set -l.

When I look at man for the set command, I don't see the -l argument.

When using tcsh shell, what does the -l argument mean?

Where & how can I find this info?

  • Do you mean the -l option to tcsh itself? As in tcsh -l? – Kusalananda Feb 13 at 18:59
  • No. I mean set -l – user3731622 Feb 13 at 21:59
2

You're looking at the wrong place. This is from the tcsh(1) manual page:

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.

So set -f list=(foo bar baz foo) will set list to (foo bar baz),

but set -l list=(foo bar baz foo) will set list to (bar baz foo),

and set list=(foo bar baz foo) will set it to (foo bar baz foo), keeping duplicates.

The only difference is how it handles duplicates in the word list. This feature is not present in the classical/real csh, which is now unencumbered open-source itself and (if I'm not mistaken) the default csh on many systems.

1

In the manual for the TENEX C shell, rather than the manual for set. The relevant part of the TENEX C shell manual has -l fourth in its synopses for the set command:

       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 ... (+)
and discusses it in the description that follows.

Look up shell builtins in the manual for the shell that they are built in to. The manual page for set that you looked at might have told you to do this. FreeBSD's manual for set certainly does:

SYNOPSIS
     See the built-in command description in the appropriate shell manual page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.