0

My code was like this I'm passing 4 arguments to a script

ex.sh "wavpath" "featpath"

"ex.sh" code is

#!/bin/bash

wavPath=$1
featPath=$2
rm -f $scpFile

echo $wavPath
echo $featPath


for dir in `ls -R $wavPath|grep ":"|cut -d':' -f1`
do
    mkdir -p ${dir/$wavPath/$featPath}
done

The error message:

bad substitution

and it is at ${dir/$wavPath/$featPath} and its showing both the paths

can anyone help

1
  • No need to use shout at us (don't use caps lock). People are less inclined to help you that way. Commented Aug 25, 2012 at 13:41

2 Answers 2

3

Try ${dir}/${wavPath}/${featPath}

Sign up to request clarification or add additional context in comments.

Comments

0

maybe you meant $dir/$wavPath/$featPath

try changing

mkdir -p ${dir/$wavPath/$featPath}

to

echo $dir/$wavPath/$featPath

and see if the output is what you expected for the input of mkdir.

Also, you're not setting a value for the variable $scpFile before you use it.

1 Comment

${dir/$wavPath/$featPath} is the problem itself, a variable is in the form ${name}

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.