I am running a shell script on my mac, and i am getting a "No Such file or directory.

The input is: the replacement\_name, and the working dir.
The output is: changing all files in the directory from `$file` to `$newfilename`

```
#!/bin/sh

echo "-------------------------------------------------"
echo "Arguments:"
echo "Old File String: $1"
echo "New File Name Head: $2"
echo "Directory to Change: $3"
echo "-------------------------------------------------"
oldname="$1"
newname="$2"
abspath="$3"
echo "Updating all files in '$abspath' to $newname.{extension}"

for file in $(ls $abspath);
do
    echo $file
    echo $file | sed -e "s/$oldname/$newname/g"
    newfilename=$("echo $file| sed -e \"s/$oldname/$newname/g\"")
    echo "NEW FILE: $newfilename"
    mv $abspath/$file $abspath/$newfilename
done

```

It seems that it doesnt like assigning the result of my 1-liner to a variable.

```
old_filename_string_template.dart
test_template.dart
./bulk_rename.sh: line 16: echo old_filename_string.dart| sed -e "s/old_filename_string/test/g": No such file or directory
NEW FILE: 

```

Test Information:

```
 mkdir /_temp_folder
 touch old_filename_string_template.a  old_filename_string_template.b  old_filename_string_template.c old_filename_string1_template.a  old_filename_string1_template.b  old_filename_string1_template.c old_filename_string3_template.a  old_filename_string3_template.b  old_filename_string3_template.c
./convert.sh old_filename_string helloworld /_temp_folder

```