![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help in replacing text with the value of a variable | lotto_123 | Shell Programming and Scripting | 4 | 06-13-2008 04:39 AM |
| sed to replace text with a variable | orahi001 | UNIX for Dummies Questions & Answers | 1 | 03-06-2008 05:25 PM |
| How to make a number in a text file a variable? | nortypig | Shell Programming and Scripting | 5 | 08-23-2006 06:43 AM |
| how to insert text using variable | mopimp | Shell Programming and Scripting | 1 | 03-24-2006 04:32 PM |
| grep multiple text files in folder into 1 text file? | coppertone | UNIX for Dummies Questions & Answers | 7 | 08-23-2002 11:50 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Text file to a variable
I have a variable which is not being populated with the contents of a text file, and I'm wondering if anyone happens to know how to do this for a sh type script? #!/bin/sh set alertperson = cat /export/home/bdodym/alert.person if [ -f /export/home/bdodym/critabend.tag ] then cat /export/home/bdodym/callout6.msg | rmail $alertperson rm /export/home/bdodym/critabend.tag fi Basically, the alertperson variable is not reading the contents of /alert.person (which is a text file simply containing 1 email address). I appreciate any assistance.... Tim |
| Forum Sponsor | ||
|
|
|
|||
|
I wish it were that easy Ikon!
Amended script: #!/bin/sh alertperson = cat /export/home/bdodym/alert.person echo $alertperson if [ -f /export/home/bdodym/critabend.tag ] then cat /export/home/bdodym/callout6.msg | rmail $alertperson rm /export/home/bdodym/critabend.tag fi Response: 6check2.sh: alertperson: not found Recipient names must be specified |
|
|||
|
...thankyou, but still its proving tricky this!!
Amended script: #!/bin/sh alertperson=$(cat /export/home/bdodym/alert.person) echo $alertperson if [ -f /export/home/bdodym/critabend.tag ] then cat /export/home/bdodym/callout6.msg | rmail $alertperson rm /export/home/bdodym/critabend.tag fi Response: 6check2.sh: syntax error at line 3: `alertperson=$' unexpected |