Resolve Relative to Absolute Paths with readlink

Written by James McDonald

July 31, 2010

Just wanted to resolve a relative file path so that I can pass it as an absolute path to a program.

#!/bin/sh

QCAD_DIR=/opt/qcad-2.2.2.0-1-prof.linux.x86
ABS_PATH=$(readlink -f "$1")

cd $QCAD_DIR && ./qcad $ABS_PATH

Credits: Andy

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Network speed test host to host

On Ubuntu / Debian apt-get install iperf3 On Windows download it from https://iperf.fr/iperf-download.php#windows Make...

Clear HSTS Settings in CHrome

Open chrome://net-internals/#hsts enter the domain in the query field and click Query to confirm it has HSTS settings...