I am new to shell scripting and having trouble doing following:
I have this:
MY_MACR0_VALUE="123ABCD"
I want to convert it to this:
#define MY_MACR0_VALUE "123ABCD"
I am doing this:
//that string is coming from command line
newvar=$(echo "$1" | tr '=' ' ')
echo "#define $newvar" >> MacroFile.h
I am getting this:
#define MY_MACR0_VALUE 123ABCD
instead of
#define MY_MACR0_VALUE "123ABCD"
The double quotes are missing.
How can I fix my script to get the desired result?
EDIT
I may also have some non valued Macros from the commandline , like
INCLUDE_SOMETHING
which should be changed to
#define INCLUDE_SOMETHING
So I dont need to change anything in them.