To quickly remove a postfix of a string in shell:
test=file.ext; echo ${test%.ext}
On the other hand, if ext is not in test, the original string is returned.
PS: There are some more standard ways to deal with extensions, like
FN=$(basename $1 .tex)
But to deal with a string is more general and has more widely usage.
No comments:
Post a Comment