I want to to this in shell-script: remove the file postfix and save it into another variable:
file=abcabc.cpp
postf=.cpp
name=${file##postf}
echo $name
But this couldn't work. I want name=abcabc after the operation. Can you help me?
You can use:
name="${file%$postf}"
echo "$name"
abcabc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With