I'm working on a script which checks if file exists. If it exists then I want to get the route.
What I did is the following:
RESULT_=$(find $PWD -name someRandom.json)
This returns the path to the file:
/Users/guest/workspace/random_repo/random/some_folder/someRandom.json
I'm stuck in the way to navigate among files. Is there a way of replacing someRandom.json
with ''
so I can do:
cd /Users/guest/workspace/random_repo/random/some_folder/
I tried using the solution provided here but it isn't working. I tried the following:
RESULT=$($RESULT/someRandom.json/'')
echo $RESULT
And this returns no such file or directory.