The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
undefined variable error c00kie88 Shell Programming and Scripting 4 05-20-2008 03:25 AM
undefined symbol: clock_gettime' error dpa078 High Level Programming 4 04-09-2008 09:29 AM
shared object "undefined symbol: fstat" error marcus121 High Level Programming 5 04-24-2006 07:11 PM
Undefined reference to Error svh High Level Programming 2 02-11-2006 12:23 AM
ld: 0711-317 ERROR: Undefined symbol: .hello stockdan High Level Programming 2 11-25-2003 05:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-11-2008
amitrajvarma amitrajvarma is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 43
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 (permalink)  
Old 01-11-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,294
You forgot to quote the string on this line:

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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0