As others have mentioned, you basically have to delete the symlink first, either manually or by passing the -f
flag to the ln
utility.
Years ago, I had to make small edits to symlinks pretty frequently, so I wrote a simple readline-based utility (edln
) to make this less annoying. In case anyone else finds it useful, I've put it online at https://github.com/jjlin/edln/.
edln
will display the original symlink target; you can then use the arrow keys, or standard readline keystrokes (M-b
, M-f
, C-d
, etc.) to move around and edit the target.