0

this is the statement

sudo update-alternatives   --install    "/usr/bin/word"    "word" 
     "/usr/lib/jvm/jdk1.8.0_version/bin/word" 1

where word needs to be replaced by these name one by one :

appletviewer   jarsigner  jconsole  jrunscript  native2ascii  schemagen       xjc
apt            java       jcontrol  jsadebugd   orbd          javac      jdb             jstack      pack200       servertool
extcheck       javadoc    jhat      jstat       policytool    tnameserv
HtmlConverter  javah      jinfo     jstatd      rmic          unpack200
idlj           javap      jmap      jvisualvm   rmid          wsgen
jar            javaws     jps       keytool     rmiregistry   wsimport

so for example our out should be like this :

sudo update-alternatives --install  /usr/bin/java java  /usr/lib/jvm/bin/java 1

sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/bin/jar

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

1

Something like this should be able to read your file line by line and word by word:

while read line; do
    for word in $line; do
        sudo update-alternatives --install /usr/bin/$word $word /usr/lib/jvm/bin/$word
    done
done < filelist  
Terrance
  • 41,612
  • 7
  • 124
  • 183