开发者

Remove first 4 letters from a folder name using Bash scripting

开发者 https://www.devze.com 2022-12-11 00:35 出处:网络
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 th

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

精彩评论

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