1
I want to make a shell script that gets a filename with its full path, for example /home/42/arquivoEscolhido.txt
, and extract only the file name (arquivoEscolhido.txt
), that in case it would be all after the last bar (/
), taking into account that the file name can always change.
I came up with something like this but it didn’t work:
echo -n 'Informe o arquivo: '
read dir #/home/42/teste.txt
arq=${dir#*/}
Thank you so much! It Works!!
– Devair Junior