I want to create a symbolic link to a file in my current working directory.
Say that I have a top level tree that looks like this:
.
├── dir1
│ └── hello.so
└── dir2
2 directories, 1 file
I change my working directory to dir1
. Now, I want to create my symbolic link of hello.so
in dir2
.
I try ln -s ./hello.so ../dir2/
. However, this does not work, as it creates a link to ./hello.so
, rather than expanding the ./
as I would expect.
ln -s ${PWD}/hello.so ../dir2/
works fine, but it's a bit verbose.
I fear I may have misunderstood what ./
expansion is, but I haven't been able to figure out what I've got wrong.
In case it's a problem specific to my environment, I am on Bash 5.0.2. I haven't been able to find any fancy flags in the ln
man.
ln
. Fixed with an edit