I would like to create symbolic links (ln -s
) to all files (or a class of files, e.g. ending with .bar
) in a certain directory.
Say I'm in the cwd and type ls ../source/*.bar
gives me
foo.bar
baz.bar
how can I pass the parameter list to ln -s
that it finally resolves to
ln -s ../source/foo.bar
ln -s ../source/baz.bar
Of course I know I can write a bash script, but there should be something simpler involving xargs
or so since it seems to be a common task – at least for me.
Best Answer
ln
does take multiple arguments, but don't forget to give a target directory in that case.So, in your example
.
is the target directory, so it should be as easy asFrom
man ln
; the command above uses the 3rd form: