Last active
October 7, 2021 15:17
-
-
Save nasirkhan/6990046 to your computer and use it in GitHub Desktop.
Remove file extension using the linux shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
#!/bin/sh | |
for file in `ls *.html` | |
do | |
newname=`echo $file|sed 's/\.html$//g'` | |
mv $file $newname | |
done | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
newname="${file//.html}"
So shorter:
This is a really good reference to learn more about bash : https://tldp.org/LDP/abs/html/
About string manipulation : https://tldp.org/LDP/abs/html/string-manipulation.html