Dalla pagina man di BSD:
-f If the target file already exists, then unlink it so that the link
may occur. (The -f option overrides any previous -i options.)
-n If the target_file or target_dir is a symbolic link, do not follow
it. This is most useful with the -f option, to replace a symlink
which may point to a directory.
il -n
opzione (insieme a -f
) forza ln
per aggiornare un collegamento simbolico a una directory. cosa significa?
supponiamo di avere 2 directory
- pippo
- barra
e un collegamento simbolico esistente
- baz -> barra
ora vuoi aggiornare baz per puntare a pippo invece. se lo fai
ln -sf foo baz
otterresti
- baz/pippo -> pippo
- baz -> bar (invariato), e quindi
- bar/foo -> foo
se aggiungi -n
ln -sfn foo baz
ottieni quello che vuoi.
- baz -> pippo
questo è ciò che significa 'no-dereference':non risolvere un collegamento esistente e posizionare il nuovo collegamento all'interno di quella directory, ma semplicemente aggiornarlo.
Ecco tutte le opzioni per ln. Troverai -n e -f qui.
-F If the target file already exists and is a directory, then remove it so that the link may occur. The -F option should be used with either -f or -i options. If none is specified, -f is implied. The -F option is a no-op unless -s option is specified. -h If the target_file or target_dir is a symbolic link, do not follow it. This is most useful with the -f option, to replace a symlink which may point to a directory. -f If the target file already exists, then unlink it so that the link may occur. (The -f option overrides any previous -i options.) -i Cause ln to write a prompt to standard error if the target file exists. If the response from the standard input begins with the character `y' or `Y', then unlink the target file so that the link may occur. Otherwise, do not attempt the link. (The -i option overrides any previous -f options.) -n Same as -h, for compatibility with other ln implementations. -s Create a symbolic link. -v Cause ln to be verbose, showing files as they are processed.