Ravi Sir's Cards › AWS
Cut prefix and suffix
This revision card explains Cut prefix and suffix. It starts from the need that # cuts from the front, shortest. It describes ## cuts from the front, longest. The how-to section notes % cuts from the end. An example on the card is %% longest from the end.
Read card text
What this card says
Why do we need it?
# cuts from the front, shortest.
What is it?
## cuts from the front, longest.
${path##*/}
How to do it
% cuts from the end.
${f%.*}
Example
%% longest from the end.
${f%%.*}