开发者

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}"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜