What does the following shell script mean? This is ksh and npfile is also a variable that contains a file name.
fileName=${npFile##/*/}
|
feedback
|
|
It strips the base off of the path to the file. In variable expansion, ## means "take the thing to my right, treat it as a pattern, and delete the longest match of it in the variable to my left." In this case the pattern is /*/, so the longest match of that in a variable which included a path and filename would be the path. Deleting it would leave only the filename. It appears to be a variable-expansion-only way of writing this:
| |||
|
feedback
|
|
That trims "/*/" (everything from the first slash to the last slash) from the beginning of the string. So if npFile="/path/to/file" - fineName would become "file" | |||
|
feedback
|