bash - Rename a folder with a variable in the center -
i trying rename folder.
current folder name = apple. want rename apsomeple.
the "some" in centre of new name variable.
i tried following doesn't work. please advice. if add end testing, works.
name="some" mv apple ap$nameple # doesn't work mv apple apple$name # works - testing
you can use {}
delimit name of variable:
mv apple ap${name}ple
if there chance variable contain space character, unlike example provided, in addition need put double quotes around enter new filename:
mv apple "ap${name}ple"
Comments
Post a Comment