Getting a command not found when comparing in tsch

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Getting a command not found when comparing in tsch
# 1  
Old 04-14-2013
Getting a command not found when comparing in tsch

Hey everyone,

I am almost done with this assignment I have to do but there is one last thing nagging me that I can't seem to find. In my script I am feeding line by line to a ./test file and I am getting the return answer correctly. The goal is to test the current script (check.sh) and if it's output is the same as the testcase.txt file then everything is good. So I have most of the script done but am still getting the "command not found" issue. I'm thinking it's something with my if statement and possibly the comparison. If anyone could point me in the right direct or let me know how to get rid of this error, I would sincerely appreciate it!!! Thank you! Below is my program and then the output it gives.

Code:
set dir="$PWD/./test"
set dir2="$PWD/testcase.txt"
set ODD=""
set EVEN=""
set oddlines=`sed -n 1~2p $PWD/testcase.txt > ODD`
set evenlines=`awk NR%2==0 $PWD/testcase.txt > EVEN`
set fodd=$PWD/ODD
set odd="`cat $PWD/ODD`"
set even="`cat $PWD/EVEN`"
set FILERETURN=""
set i=1
set j=1
set counttot=0
set countpass=0

while ($i <= $#odd)
 while ($j <= $#even)
  
  set FILERETURN=(`echo $odd[$i] | $dir`)
     
    #echo $FILERETURN
    #echo $even[$j]
    if $FILERETURN == $even[$j] 
         @ countpass = $countpass + 1
    endif
  #echo $odd[$i]
  
  #echo $even[$j]
   @ counttot = $counttot + 1
   @ i = $i + 1
   @ j = $j + 1
  end
end

echo "passed/total tests" $countpass "/" $counttot
rm ODD EVEN

Code:
% check.sh
-1: Command not found.
0: Command not found.
-1: Command not found.
-1: Command not found.
-1: Command not found.
-1: Command not found.
-1: Command not found.
0: Command not found.
passed/total tests 10 / 10

# 2  
Old 04-14-2013
I don't think bumping up posts (see this) will charm the moderators of this forum.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error in tsch shell scripting..

Hi Everyone, I am using gdb-7.5 to connect to the target. When I gave the./configure --target=xyz --build=i686-pc-mingw32 --host=i686-pc-mingw32 command then checking build system type... i686-pc-mingw32 checking host system type... i686-pc-mingw32 checking target system type... xyz-mingw32... (3 Replies)
Discussion started by: Heeka
3 Replies

2. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

3. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

4. Shell Programming and Scripting

Comparing a command with a string

Is this possible? If so it seems like a very easy and short script.I'd like to make a script that will print a friendly message but only if it is on your personal terminal. so the code would look like this: #!/bin/csh if ; then echo "This is a friendly message :D "; fi thats what i have... (4 Replies)
Discussion started by: Waffles
4 Replies

5. Shell Programming and Scripting

comparing output of who command

I have a need to take the output of the who command and first strip out users with only 1 session, then of the remaining users I need only to list the ones who are using more than 1 IP address Normal output: tander01 pts/113 Feb 11 09:21 (10.25.1.23) tbanks pts/81 ... (4 Replies)
Discussion started by: mshilling
4 Replies

6. Shell Programming and Scripting

Comparing two files and printing 2nd column if match found

Hi guys, I'm rather new at using UNIX based systems, and when it comes to scripting etc I'm even newer. I have two files which i need to compare. file1: (some random ID's) 451245 451288 136588 784522 file2: (random ID's + e-mail assigned to ID) 123888 xc@xc.com 451245 ... (21 Replies)
Discussion started by: spirm8
21 Replies

7. Shell Programming and Scripting

tsch, error setting a variable

Hi, my code is: ------------------------------ set r=`ls -L $source_dir/*.snvf` echo AAA ------------------------------ If does file does not exists I got on the screen ls: No match. AAA How can I remove the "ls: No match." from being printed out Regards, Ziv (2 Replies)
Discussion started by: zivsegal
2 Replies

8. UNIX for Dummies Questions & Answers

Why isn't this working? tsch-doit file

#! /usr/tsch foreach f (`cat contacts.list`) awk '{printf ($2 in a) ? ","$5 : (NR>1) ? RS $2 FS $5 : $2 FS $5; a} END{print e}' $f > $f_inter.map end My file: cat contacts.list is just a list of files. I get this error: doit_contacts2intermap.sh: Command not found. Thanks! (1 Reply)
Discussion started by: lost
1 Replies

9. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies

10. UNIX for Dummies Questions & Answers

how to change sh to tsch UNIX

My oracle account uses tsch to use .cshrc. "Somehow" it was switch to sh and changed the login environment. My question is who has the right to change sh to tsch or other shells? How can I change back the original setting(tsch) from sh? This is what is appear in my /etc/passwd: ... (2 Replies)
Discussion started by: simt
2 Replies
Login or Register to Ask a Question