Find the answer to your Linux question:
Results 1 to 4 of 4
hi all, Damm I am noob in scripting. i can;t find what i am doing wrong. please help me. if i execute script from a comand line vilmmi3:budintis > cat ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2006
    Posts
    6

    csh set var


    hi all,
    Damm I am noob in scripting. i can;t find what i am doing wrong. please help me.

    if i execute script from a comand line
    vilmmi3:budintis > cat /home/tmp/sites | grep 500Ch
    B26; KaunoTelevizija-Kau-S-U-500[6]; 5 500Ch; 20492


    if i wrote a csh script called test:

    #!/bin/csh
    set dir = `cat /home/tmp/sites | grep 500Ch`
    echo $dir

    vilmmi3:budintis > test
    set: No match



    I want thet my script test will set B26; KaunoTelevizija-Kau-S-U-500[6]; 5 500Ch; 20492 to variable dir
    p.s sorry for stupid question, everyone have someday to begin.

  2. #2
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942
    I think there can be no spaces between the variable name, the "=", and the value:
    Code:
    set dir=`cat /home/tmp/sites | grep 500Ch`
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  3. #3
    Just Joined!
    Join Date
    Aug 2006
    Posts
    6
    hmm i wrote set nonomatch in the script and it works. can someone explain what does set nonomatch do?

    #!/bin/csh
    set nonomatch
    set dir = `cat /home/tmp/sites | grep 500Ch`
    echo $dir

  4. #4
    Banned CodeRoot's Avatar
    Join Date
    Sep 2005
    Posts
    567
    In a C-shell, it is O.K. to have spaces on left and/or right side of '='...

    From 'man csh':

    Code:
    nonomatch
                   If  set,  a Filename substitution or Directory stack substitution (q.v.) which does not match any existing files is left untouched rather
                   than causing an error.  It is still an error for the substitution to be malformed, e.g., `echo [' still gives an error.
    For more info, do a 'man csh' and search for the word 'nonomatch'...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •