12
In a variable that contains 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)
Which results in ficheiro.pdf
in the variable filename
.
How can we extract only the path to said file ?