Search code examples
shellawkfilenamessymlinkhardlink

creating soft links with the same name as the target file


ln -s /dir1/file1   /dir2/file1

I'd like to create a softlink in target dir1 with same filename as source in dir2 How is this done without typing the file1 name over in the target path


Solution

  • You can do it with ln-only options:

    ln -s -t /dir1 /dir2/file1