SyntaxFix
Write A Post
Hire A Developer
Questions
FILEPATH="file.txt" echo $(realpath $(dirname $FILEPATH))/$(basename $FILEPATH)
This works even if the file doesn't exist. It does require the directory containing the file to exist.