It is currently Tue, 30 Nov 2021 18:05:47 GMT



 
Author Message
 wildcard expansion and symbolic links (csh, sh, ksh, bash)

Obviously I neglected to finish the above sentence.  It should read
"... while csh and ksh behave unexpectedly (at least to me)."

-----------------------------------------------------------------
| John A. Turner                                                |
| Los Alamos National Laboratory, MS B226, Los Alamos, NM 87545 |
| Group: X-6 (Radiation Transport)                              |
| Location: TA-3, Bldg. 43, Rm. D263                            |
| Phone: 505-665-1303                   e-mail: tur...@lanl.gov |
-----------------------------------------------------------------



 Tue, 07 Mar 1995 03:40:20 GMT   
 wildcard expansion and symbolic links (csh, sh, ksh, bash)
This deals with wildcard expansion in various shells when dealing
with symbolic links.  

The problem arises when the file to which a symbolic link points
doesn't exist.  In summary, it looks to me like sh and bash
behave correctly while csh and ksh.

Consider the following:

strat% mkdir good bad
strat% ls file fool
file not found
fool not found
strat% touch file
strat% ln -s ../file good/test
strat% ln -s ../fool bad/test     <== note that bad/test points to
                                      a file that doesn't exist
strat% ls */test; ls */tes*; echo */test; echo */tes*
good/test
bad/test   good/test
good/test
bad/test good/test
strat% sh
$ ls */test; ls */tes*; echo */test; echo */tes*
bad/test   good/test
bad/test   good/test
bad/test good/test
bad/test good/test
$ exit

All csh's I've tried exhibit the same (let's call it "unexpected")
behavior:    SunOS 4.1.1, 4.1.2
             ULTRIX V4.2 (Rev. 96)
             UNICOS 6.0.11
The ksh that was on the ULTRIX V4.2 (Rev. 96) machine also exhibited
this behavior.

All sh's I've tried exhibit the "expected" behavior (same systems
as above), as did bash-1.12 (on SunOS 4.1.1, although it shouldn't
matter).

Any comments?

-----------------------------------------------------------------
| John A. Turner                                                |
| Los Alamos National Laboratory, MS B226, Los Alamos, NM 87545 |
| Group: X-6 (Radiation Transport)                              |
| Location: TA-3, Bldg. 43, Rm. D263                            |
| Phone: 505-665-1303                   e-mail: tur...@lanl.gov |
-----------------------------------------------------------------



 Tue, 07 Mar 1995 03:30:42 GMT   
 wildcard expansion and symbolic links (csh, sh, ksh, bash)
In article <1992Sep17.193042.4...@newshost.lanl.gov> tur...@beta.lanl.gov (John A. Turner) writes:

Yes, this is definitely a bug. It is easy to fix if you have the source.
Change the stat() on the globbed pattern to an lstat(). I know that the
4.3 csh was getting it wrong; the 4.4 csh and tcsh-6.0+ are doing the
right thing.

christos



 Tue, 07 Mar 1995 22:54:56 GMT   
 
   [ 3 post ] 

Similar Threads

1. symbolic links and var expansion inside Bash script

2. csh and ksh symbolic link differences

3. Execution order of files for csh/ksh/sh/bash

4. ksh, sh, bash, csh,.........

5. Wildcard expansion on bash' commandline

6. Preventing wildcard expansion in the (Linux bash) shell.

7. Symbolic Links Wildcards?

8. Question on order of filename expansion of {a,b}/{c,d} in bash (or csh)

9. Too many symbolic links, Symbolic link loop


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software