Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get full path from "../" on command line in Linux shell script

Tags:

linux

shell

If I have a shell script where I get the parent folder using "../" can I expand that out somehow into it's absolute path?

like image 549
Rob Segal Avatar asked Oct 24 '11 15:10

Rob Segal


1 Answers

You want readlink -f.

$ cd /tmp
$ readlink -f ..
/
like image 98
Ignacio Vazquez-Abrams Avatar answered Oct 08 '22 18:10

Ignacio Vazquez-Abrams