The only answer to the question (on assignment): why ln behaves like cp is: It can not.
The only possible answer: what you present to us is not quite what is being executed, or there are other scripts that change the answer.
Some possible alternatives are:
1.- The ln command actually executes a hard link. The i-node list ( ls -li ) confirms that the i-node numbers are different. So no, that’s not the reason.
2.- Is there an alias or function for ln ?
This is easy to verify. Just type type -a ln inside Bash. As a result, it will be shown that bash will interpret ln . If this is ONLY the /bin/ln file, then this is correct.
You have confirmed that there is no alias or function.
3.- Like "the script is launched from another directory". The point here is: is there another file in the file system that has the same i-node number (if ln actually creates a hard link). The existence of any other file with the same i-node can be checked with (use inode numbers 53.54.56 from your list):
find / -follow -inum <your inum>
4.- I hope you really know that config-b.properties does not actually exist (as a file). Editing such a file may delete the link.
Is the actual script also changing / updating the contents of the file?
Note01: Note that trick K only allows one external call to be retrieved: http://www.charlestonsw.com/perl-regular-expression-k-trick/
ACTIVE_DB=$(grep -Po "^[ \t]*db.active[ ]+=[ ]+\K." config.properties)
It was confirmed that the source config-b.properties later in the actual executed script was sed -i to config-b.properties .
user2350426
source share