In a variable containing the path to a file and its name, the file name can be extracted as follows:
#!/bin/bash
filenamepath="/caminho/para/ficheiro.pdf"
filename=$(basename $filenamepath)
What results in ficheiro.pdf
in variable filename
.
How can we just extract the path to the file?