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

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -