![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| assigning date value to a variable | mansoorbabu | Shell Programming and Scripting | 1 | 06-13-2008 07:35 AM |
| Assigning Value of variable | janemary.a | Shell Programming and Scripting | 2 | 05-11-2007 05:53 AM |
| Assigning a value to variable | sirtrancealot | Shell Programming and Scripting | 3 | 07-15-2006 03:07 PM |
| assigning variable value using echo | shellburger | Shell Programming and Scripting | 2 | 07-11-2005 11:52 AM |
| assigning a variable containing hostname | esham | Shell Programming and Scripting | 4 | 03-08-2005 12:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Assigning evaluated expression to a variable
Hello,
Could you please let me know what is the problem here.. 28:var1="SERVER_$j" 29:eval $var1=`grep "^DBSERVER=" "$i" |cut -d"=" -f2` i get this error: syntax error at line 29 : `|' unexpected Thanks for your quick response..This is urgent..pls.. Regards Kaushik |
|
||||
|
Code:
#!/usr/bin/bash i=test.txt j=B10 var1=SERVER_"$j" echo "DBSERVER = $var1" eval var1=`grep "^DBSERVER=" "$i" | cut -d"=" -f2` echo "DBSERVER = $var1" Code:
line 1 DBSERVER=SERVER_XXX line 3 DBSERVER=SERVER_A1 line 5 Code:
HOSTNAME:> test.sh DBSERVER = SERVER_B10 DBSERVER = SERVER_A1 |
![]() |
| Bookmarks |
| Tags |
| assignment, bash, bash eval, cut, eval, grep, variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|