1

I've a shell script at

/home/abc/xyz/test.sh

I've a file at

/home/def/ghi/jkl/lmn/foo.txt

I'm running the scrip from /home as I've set my PATH variable to point to /home/abc/xyz/

I'm passing the relative path of foo.txt to my script like so test ./def/ghi/jkl/lmn/foo.txt

I want to capture the full path of foo.txt into a variable in my script, any pointers?

Tried https://stackoverflow.com/a/5265775 and https://stackoverflow.com/a/9107028/4468505 but in vain.

0

1 Answer 1

0
foobar=`readlink -f <passed in relative path to foo.txt>`
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.