Hi guys I am trying to write a shell script which installs java and sets the paths for it.
For this I was trying to get the root folder where I have installed Java. I successfully did so by using grep command. My java home directory is like this /usr/bin/java
. I obtained usr
directory separately. Now I want to add /usr
string literal to a variable. But it's just adding usr
with a white space before it.. Can anyone help me out with this.
Here is the example I'm giving not the real one though...
directory="/usr/bin/java"
echo $directory
IFS=/
set $directory
echo /$2
t=$'/'$2
echo $t