ln -s accept wildcards?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ln -s accept wildcards?
# 8  
Old 09-26-2011
I still don't understand what the problem is with using ln -s with wildcards Smilie. I've what you have said several times with no luck.
# 9  
Old 09-27-2011
Well, the bottom line is that your command will fail with an error message if you have more than one version of JDK/JRE installed. If you have no error message, it should just work as expected.

Should you have more queries, please be more specific. Sentences like "It doesn't seem like it is working when I use wildcards." cannot lead anyone to understand what your problem is.
# 10  
Old 09-28-2011
Quote:
Originally Posted by COKEDUDE
I still don't understand what the problem is with using ln -s with wildcards Smilie
Wildcards don't do what you think they do.

A symlink is just a special kind of file whose contents are one literal filename. They're handled by the kernel, directly. When you open one, the kernel sees the contents and goes "hmm, this is a symlink to /usr/java/default/lib/i386/libnpjp2.s, I need to go open that instead". The filename is literal. A * won't be taken to be a wildcard, just a literal part of the name -- it is possible to create files and dirs named *...

Wildcards are handled by the shell, before you run ln. If multiple JRE's exist, your wildcards feed the whole list of things into ln, which isn't what you want -- it will try to create multiple links, like so:

Code:
$ mkdir e
$ touch a b c d
$ ln ../a ../b ../c ../d e # a b c d are links to be made, e is destination dir
$ ls -l e
total 0
lrwxrwxrwx 1 tyler users 4 Sep 28 08:59 a -> ../a
lrwxrwxrwx 1 tyler users 4 Sep 28 08:59 b -> ../b
lrwxrwxrwx 1 tyler users 4 Sep 28 08:59 c -> ../c
lrwxrwxrwx 1 tyler users 4 Sep 28 08:59 d -> ../d
$

When you force the link contents a literal * character, that won't help you because the kernel is not a shell, and won't expand * characters.

Quote:
I've what you have said several times with no luck.
What, exactly did you try, and in what way did it not work?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Renaming with wildcards

Hi, I'm new to Unix, but have a directory which has many files in it, well over 1000. The files are called : M07GO.STOPE0001 M07GO.STOPE0002 M07GO.STOPE0003 M07GO.STOPE0004 etc... I would like to rename them to the following : M070001.bin M070002.bin M070003.bin M070004.bin etc....... (4 Replies)
Discussion started by: rnmuk
4 Replies

2. Shell Programming and Scripting

Wildcards and exceptions

Hello: I have a very basic question. I'd like to select all files except for one file. For example, say I want to move all of the files in my current directory to a subdirectory called archive, I would use mv ./* archive/ But what if I want to move all files except for README.txt? Is there an... (19 Replies)
Discussion started by: Danny.Boy
19 Replies

3. UNIX for Dummies Questions & Answers

Help with rm command with wildcards

Hello everyone. My first time posting here. I have a question that may seem very insignificant to some but is one that I've been trying to address for the past several days (haven't had any luck looking online). I'm trying to clean a directory by removing old files that we no longer need.... (2 Replies)
Discussion started by: galileo1
2 Replies

4. Shell Programming and Scripting

figuring out wildcards

I'm trying to delete everything between ( and ) in a line, ie: ( start xxxx, end xxx ). there is uppercase, lowercase and numbers in the parans. and are of varied length. I tried this: sed 's/()//' infile > outfileI'm not understanding the wildcard use in brackets (2 Replies)
Discussion started by: dba_frog
2 Replies

5. UNIX for Advanced & Expert Users

Wildcards

These 2 websites do a GREAT job of explaining different types of wildcards. I learned about the categories of characters which I never knew about at all. GNU/Linux Command-Line Tools Guide - Wildcards GREP (1 Reply)
Discussion started by: cokedude
1 Replies

6. UNIX for Dummies Questions & Answers

wildcards NOT

Hi All Please excuse another straightforward question. When creating a tar archive from a directory I am attempting to use wildcards to eliminate certain filetypes (otherwise the archive gets too large). So I am looking for something along these lines. tar -cf archive.tar * <minus all *.rst... (5 Replies)
Discussion started by: C3000
5 Replies

7. Shell Programming and Scripting

wildcards with if statement?

Hello i am trying to use the wildcards with the if statement but it is displaying the error like this one if * | ** | * ] Any body can help me to for using the wild card option in the if case but i have used this code and working well with the case statement to enter the name without the... (14 Replies)
Discussion started by: murtaza
14 Replies

8. UNIX for Dummies Questions & Answers

ls with wildcards

ok, I'm trying to write a script file that lists files with specific elements in the name into a txt file, it looks like this ls s*.dat > file_names.txt can't figure out whats wrong with that line, any ideas? thanks in advance (10 Replies)
Discussion started by: benu302000
10 Replies

9. UNIX for Dummies Questions & Answers

wildcards

when writing a shell script (bourne) and using a unix command like 'ls' is there anything special you need to do to use a wildcard (like *)? (3 Replies)
Discussion started by: benu302000
3 Replies

10. UNIX for Dummies Questions & Answers

Wildcards in VI

I'm trying to delete lines from a large text file using VI. Every line that I am wanting to delete start with 'S' - all others do not. (A list of users) I've tried using * but doesn't seem to like it...any ideas... Doesn't have to be VI - but I'm better with VI than sed/awk. (8 Replies)
Discussion started by: peter.herlihy
8 Replies
Login or Register to Ask a Question