Amazon Interview Question

what is relative path? write a program to convert relative path to absolute path.

Interview Answers

Anonymous

Aug 10, 2012

#!/bin/sh myPath='/usr/./local/../../bin/./../var/./log/' cd $myPath newPath=`pwd` echo $newPath

6

Anonymous

Nov 24, 2016

and add the relative paths as an argument to the script myPath=$1

1

Anonymous

Feb 12, 2012

readlink doesn't accept any parameter "-m"

1

Anonymous

Feb 8, 2012

readlink -m "relative path" Example., readlink -m .. Will give the absolute path of the parent directory

Anonymous

Jul 29, 2009

convert /usr/./local/../../bin/./../var/./log/ the absolute path for this is /var/log/ I had been asked to write a shell script to find it.

2