Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   shell scripting (http://www.go4expert.com/forums/shell-scripting-t14711/)

saragu 23Oct2008 15:53

shell scripting
 
Hi,
I wrote a shell script for converting the .mat files to .c and .c files to .so files...please let me know whether it is correct or not ........
Code:

echo "enter file name:\c"
read flname
if grep "$flname.mat" FSEIC then
gen_tp4 $flname.mat
 if grep "$flname.c" FSEIC then
  rtt_make $flname.c > SOFILES
 else
  echo "compilation error"
else
echo "file not found"
fi


xpi0t0s 30Oct2008 15:02

Re: shell scripting
 
Wow, there's so much missing from this question that it's hard to know where to start.

Let's start with a very simple question: Does it work (does it generate the required files, and do the required files do the job they're supposed to do)? If it does, then obviously yes it's correct, and if it doesn't, then obviously no it isn't. This obviously assumes that "correct" means "it works", so if your definition of "correct" goes beyond this, please explain exactly what you mean. For example there may be coding standards you have to conform to, and if one of those standards is that indentation must be done with tabs instead of spaces, then even if the script does its job perfectly, it's still not correct because it uses spaces rather than tabs to indent.

Why not ask one of your colleagues, who might know some of the necessary background? Or at least give us that background, such as what are .mat files, what is the significance of FSEIC, what is SOFILES, what is rtt_make, what is gen_tp4? What platform(OS) are you using and what version? What are the .so files used for, and where do the .c files come from?

At a guess I'd say the script probably is not correct, because you're redirecting the output of rtt_make to SOFILES, where output refers to text messages printed by make, not files generated by commands invoked by make. And redirecting text messages is not the correct way to make a shared object.


All times are GMT +5.5. The time now is 17:48.