shell scripting

Discussion in 'Programming' started by saragu, Oct 23, 2008.

  1. saragu

    saragu New Member

    Joined:
    Oct 23, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice