c shell scripting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BigBoizVince
    New Member
    • Mar 2008
    • 1

    c shell scripting

    I'm a beginner in UNIX and am stuck on a problem.

    1. I read the input from the user

    2. next I grepped the input into a text file to see if there is a match, if there is the output would be sent to a file called "count" and it will either have a 1 for a match or 0 for no match.

    3. my next problem is how could I call the number in the text file "count" to be placed in a variable which would be used in an IF Then statement that if a 1 exists it would echo an instruction and if it was 0 then it would move on to the next file to see if there is a match.

    for example I want something like this "varname= cat count"
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #2
    Originally posted by BigBoizVince
    I'm a beginner in UNIX and am stuck on a problem.

    1. I read the input from the user

    2. next I grepped the input into a text file to see if there is a match, if there is the output would be sent to a file called "count" and it will either have a 1 for a match or 0 for no match.

    3. my next problem is how could I call the number in the text file "count" to be placed in a variable which would be used in an IF Then statement that if a 1 exists it would echo an instruction and if it was 0 then it would move on to the next file to see if there is a match.

    for example I want something like this "varname= cat count"

    I am assuming 'count' is a name of your file..which contains 1 or 0
    then catch it in some variable..
    var=`cat count`
    use var as per your choice

    Comment

    Working...