undefined error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting undefined error
# 1  
Old 01-11-2008
undefined error

Hi

following is a simple shell script,
--------------------------------
#!/usr/bin/tcsh

u=$USER
echo $u
string="cp c2960-lanbase-mz /tftpboot/$u/c2960-lanbase-mz"
string2="cp c2960-lanlite-mz /tftpboot/$u/c2960-lanlite-mz"
output=/users/$u/c2960-log.txt

if [ grep --quiet $string $output ] && [ grep --quiet $string2 $output ]
then
echo c2960-lanbase-mz >> /users/$u/success.txt
echo c2960-lanlite-mz >> /users/$u/success.txt
else
echo c2960-lanbase-mz >> /users/$u/failure.txt
echo c2960-lanlite-mz >> /users/$u/failure.txt

fi

----------------------

when execute I am getting following error

./shellscripts/grtest.sh
u=amvarma: Command not found.
u: Undefined variable.

Please let me know

Thx

Amit
# 2  
Old 01-11-2008
You forgot to quote the string on this line:

Code:
output=/users/$u/c2960-log.txt

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Error term undefined

i keep getting this error when i ssh using my id - any idea (2 Replies)
Discussion started by: tariq_m
2 Replies

2. UNIX for Dummies Questions & Answers

Undefined variable error

I am getting the error undefined variable even after following these steps #read name abcd #echo $name na: undefined variable (6 Replies)
Discussion started by: Vishawdeep
6 Replies

3. Programming

Error: undefined reference to winmain@16?

I was trying to compile the following code in cygwin using g++: ------------------------------------------ #include <iostream> using namespace std; int identity(int input) { int output = input; return output; } ------------------------------------------ I get this error: ... (7 Replies)
Discussion started by: DyslexicChciken
7 Replies

4. Programming

gmake undefined symbol error

I have a C code which i am trying to compile using gcc. When i am trying to compile it i get the error undefined symbol error though i am providing the -l*** option where *** refers to the module where the object files for those symbols are present. Can someone help me on the same. (4 Replies)
Discussion started by: manaankit
4 Replies

5. Shell Programming and Scripting

Undefined variable error in csh script

Below csh script gives error: Undefined variable:confused: #!/bin/csh $QUERY="netscape"; COUNT_NETSCAPE=${ps | grep -c $QUERY}; echo $COUNT_NETSCAPE; when run gives error adroit:/home/seo/hitendra 64 ] ./unix_6.sh QUERY: Undefined variable. What is the root cause of the... (3 Replies)
Discussion started by: hiten.r.chauhan
3 Replies

6. Shell Programming and Scripting

MANPATH undefined error

Hello All, I m using Linux OS and the default shell is C shell. Till today the startup file (.login ) was invoking first and the environment variable set there working properly but after some software installation - now the .login file is not invoking at the startup and subsequently the... (1 Reply)
Discussion started by: jambesh
1 Replies

7. Programming

Error: Undefined Symbol ..... First referenced in file......

Hi, I am working with Solaris 5.9 and I am newbie in Socket programming and I stated working with socket programming and I copyed a simple client & server program from a website which I am attaching with this and when I am compiling these files.I am getting the error-- Please Help me to... (1 Reply)
Discussion started by: smartgupta
1 Replies

8. Shell Programming and Scripting

undefined variable error

Hi all, Im using a script which contains read command.. the script works perfectly but when I alias the script it gave "undifined variable" after I enter the read command input (variable)... Does any one know why ? (4 Replies)
Discussion started by: yahyaaa
4 Replies

9. Programming

undefined symbol: clock_gettime' error

Hi, i've compiled my app on x86_64 with -m32 gcc option. Can anybody tell me what is/would typically cause the 'undefined symbol: clock_gettime' error?? -1 k){0N!x y} '/home/da71336/simon/mkvfh/mkv.so: undefined symbol: clock_gettime @ "q" "subr:mkv 2:`subr,3; subc:mkv 2:`subc,1;... (4 Replies)
Discussion started by: dpa078
4 Replies

10. Programming

Undefined reference to Error

Hello, plz help me out with this error, i am getting this error when i compile my code with gcc. /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../crt1.o(.text+0x18): In function `_start': : undefined reference to `main' /tmp/cciLxqdV.o(.text+0x3c): In function `HandleUserTransaction()':... (2 Replies)
Discussion started by: svh
2 Replies
Login or Register to Ask a Question