It seems like it should be simple to symlink one file to a new file in a subdirectory.... ....without moving subdirectories. But something about the syntax is perplexing and counter to what I would expect. Here's a test case:
mkdir temp cd temp mkdir deploy echo "Contents of the build file!" > deploy/resources.build.php ln -s deploy/resources.build.php deploy/resources.php cat deploy/resources.php #bad symlink
This just creates a broken symlink! I am running this in a build environment setup script, so I want to avoid changing the current working directory if at all possible.
ln -s deploy/resources.build.php resources.php cat deploy/resources.php
Also doesn't work because it creates the symlink in the temp directory instead of the deploy subdirectory.
cd deploy ln -s resources.build.php resources.php cd ..
This works, but I'd prefer to know how to do it without changing directories.
Using a full path like:
Works, but is unweildy and somewhat impractical, especially in a build environment where all the project stuff might be different between builds, and the like.
How can I create a symlink between two files in a subdirectory, without moving into that subdirectory and out of it, and while giving the new file "alias" a new name?