0

I have a code as

while read name; do uuencode "$name" "${name##*/}"; done

but I do not understand what is meaning of ##*/ in "${name##*/}"

Google doesn't give good results. Can someone please explain.

Aravind
  • 1,559
  • 9
  • 31
  • 44

1 Answers1

2

This is used to get the filename from the full path. This is similar to using the basename command.

Example:

filename="/tmp/test.txt"
echo "$filename" "${filename##*/}"
/tmp/test.txt test.txt
basename "$filename"
test.txt``
peterph
  • 30,520
  • 2
  • 69
  • 75
rahul
  • 1,181
  • 7
  • 19