Remove first 4 letters from a folder name using Bash scripting
As the title says I want to remove the first 4 letters from a folder name using a B开发者_如何学Goash script. If you have another way to do it in Linux I don't really mind e.g. Python. Also I need the script to be executed regularly (daily).
Another way in Bash:
$ dname=mydirectory
$ echo ${dname:4}
rectory
Since you don't mention to rename a directory or so, I assume you want simple string editing. If you want more, you should ask the right questions.
# name of the DIRECTORY (not ''folder''...)
name=fooodir
# compute a new name
editedname=${name#????}
echo "${editedname}"
精彩评论