I have a shell script for renaming multiple files in a folder. It works on a rhel host but throws error on a ubuntu14 host.
#!/usr/bin/env bash
SOME_NUMBER=1
rename _file_name.c _file_${SOME_NUMBER}.c path/of/file/*_file_name.c
What changes shall i make in the code to make it work on a ubuntu14 host?
EDIT-1:
For running the code on ubuntu machine i made following change and it works:
rename 's/\_file_name.c$/\_file_1.c/' path/of/file/*_file_name.c
but following doesn't works and i get below error message:
rename 's/\_file_name.c$/\_file_${SOME_NUMBER}.c/' path/of/file/*_file_name.c
ERROR MESSAGE:
Global symbol "$SOME_NUMBER" requires explicit package name at (eval 1) line 1.
Global symbol "$SOME_NUMBER" requires explicit package name at (eval 1) line 1.