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.

Community
  • 1
  • 1
samdset
  • 233
  • 1
  • 5
  • 19

1 Answers1

0
foobar=`readlink -f <passed in relative path to foo.txt>`
Eugene Yao
  • 15
  • 5