[comp.unix.questions] Option Filenames

bear@whuts.UUCP (11/18/87)

If a file in your directory is named "-i" and you try
to do an "rm *", then it will interpret "-i" as an option
to "rm" and start inquiring if you want to remove all the files.

So if I put a "-l" filename in my directory and do an
"ls *", why doesn't it give me an "ls -l" output?
Does the 'argv' get interpreted differently in these two
sources?

BTW....I am on a VAX 11/785 running SYSTEM 5.0.2 SV_R2
       or is it 5.2.2 ..... one of those...

Curiously,

bear@whuts.UUCP (11/18/87)

Guy Belliveau
AT&T BELL LABS
Andover Tech Center
Andover Ma 01810
{ihnp4}!whuts!bear

rogerc@ncrcae.UUCP (11/19/87)

In article <3286@whuts.UUCP> bear@whuts.UUCP (BELLIVEAU) writes:
> So if I put a "-l" filename in my directory and do an
> "ls *", why doesn't it give me an "ls -l" output?
> Does the 'argv' get interpreted differently in these two
> sources?

The "-l" file would have to be the first file in the directory to get
the expected results.  Try it on a directory with only one file, "-l", 
to test this.

	-Roger Collins
	 rogerc@ncrcae.Columbia.NCR.COM

alen@cogen.UUCP (Alen Shapiro) (11/20/87)

In article <3286@whuts.UUCP> bear@whuts.UUCP (BELLIVEAU) writes:
>
>If a file in your directory is named "-i" and you try
>to do an "rm *", then it will interpret "-i" as an option
>to "rm" and start inquiring if you want to remove all the files.
>
>So if I put a "-l" filename in my directory and do an
>"ls *", why doesn't it give me an "ls -l" output?
>Does the 'argv' get interpreted differently in these two
>sources?
>
>BTW....I am on a VAX 11/785 running SYSTEM 5.0.2 SV_R2
>       or is it 5.2.2 ..... one of those...

It does on sun OS/3. Are you sure the "-l" file is lexically first
in your directory.

Try "echo *" and see if the * substitution prints in directory order
or lexical order. i.e.
	% touch a
	% touch b
	% cat > -l
	^D
	% echo * 
	a b -l
If this is what is happening then ls * would not necessarily accept "-l"
as an argument. BTW the above "echo *" gives "-l a b" on the sun. Does this
mean that "*" involves a lexical argument sort in the csh?

--alen the Lisa slayer (it's a long story)