0

is it possible to overwrite the exiting link

Without to get fail/error with standard output 1 ?

( like mkdir -p )

ls -ltr  /hadoop
lrwxrwxrwx. 1 root root 12 Jun 25 12:51 /hadoop -> /data/hadoop

ln -s   /data/hadoop /hadoop
ln: failed to create symbolic link ‘/hadoop/hadoop’: File exists
# echo $?
1


ln -sf   /data/hadoop /hadoop
ln: ‘/hadoop/hadoop’: cannot overwrite directory

expected output

ln -s (extra flags?)   /data/hadoop /hadoop
# echo $?
0
jango
  • 59
  • 2
  • 3
  • 12

1 Answers1

-1

You can use the -nf option:

ln -snf /data/hadoop /hadoop

dkokmadis
  • 574
  • 2
  • 9