简体   繁体   中英

Bash script - Need help getting match and substitution working

I am trying to get parameter substitution working in my bash script ... I know I have gotten this all wrong ... I am trying to create a script that will rename a PART of a file.

#!/bin/bash
for i in *.hpp; do  mv -v "$3 ${$3/$1/$2}" ; done

The error I am getting is:

line 2: $3 ${$3/$1/$2}: bad substitution

${$3} will attempt to interpolate ${"CONTENTS OF $3"} into a variable. It is more likely that you want ${3} . It is even more likely that you want ${i} .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM