Article 4YY3M How to change the path location within the shell script?

How to change the path location within the shell script?

by
bealefay
from LinuxQuestions.org on (#4YY3M)
I am trying to find the installed tomcat version and location of the server.xml file to get the tomcat port number.
Using below script to do that.
Code:#!/usr/bin/env bash

var1=$(find / -name "version.sh" ! -size 0 2>&1 |egrep -v "tmp|docker")

for loc1 in $var1
do
abc=$(echo "$loc1" | rev | cut -c 11- | rev)
tomcat_version=$(cd "$abc";./version.sh | grep "Server number:" | awk '{print $3}')
tomcat_status=`tomcat`

if [ "$tomcat_version" != "" ];then
echo $tomcat_version
echo "$abc"

break
fi
donebut in order to get the port number i want to change from tomcat/bin to tomcat/conf location.
For that i tried to use below synatx but it's not working.

echo "$(cd "$abc";../..)"

Can someone please suggest how to change the path ?latest?d=yIl2AUoC8zA latest?i=u0t8nvIdZvA:lnd4pq25UPE:F7zBnMy latest?i=u0t8nvIdZvA:lnd4pq25UPE:V_sGLiP latest?d=qj6IDK7rITs latest?i=u0t8nvIdZvA:lnd4pq25UPE:gIN9vFwu0t8nvIdZvA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments