It is currently Mon, 08 Aug 2022 19:09:04 GMT



 
Author Message
 file contents into shell/env variable

Hello, can you show me a simple way to read a file into a shell/env
variable?

 What I intended to do is read the .signature file into MAILX_TAIL
variable, so that I can use the same signature in elm and Mail (I'm
using solaris 2.5). My error history (in csh):

 % set x=`cat .signature`   # no, shell breaks it into words
 % set x="`cat .signature`" # no, it's broken into lines

 % set dollar='$'
 % set x="`cat .signature | sed -e 's/$dollar/\\/'`"

   (I was trying to replace the newline with backslash-newline. nope,
    didn't work as the leading spaces are thrown out)

 It was easy in sh:

 $ IFS=''
 $ set `cat .signature`
 $ MAILX_TAIL=$1

 Then how can I wrap around the shell command so that I have the right
value of MAILX_TAIL in csh ?

 Thanks in advance,

                      --WG.



 Mon, 25 Oct 1999 03:00:00 GMT   
 file contents into shell/env variable

chsh /bin/ksh
or use this script:

#!/bin/sh
IFS1="$IFS"
IFS=''
MAILX_TAIL=`cat .signature`
IFS="$IFS1"
mailx

--
Bill Marcum    bmarcum at iglou dot com
If gnus are outlawed, only outlaws will have gnus.



 Wed, 27 Oct 1999 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. file contents into variable, or global variable from shell script

2. ENV Shell Variable to Normal Variable Qn

3. shell scripting: echoing contents of contents of variable

4. How do i transfer the contents of shell variable to a variable used in C program

5. Setting env. variable within shell script

6. how to set env. variables in shell script

7. Executing a shell script to set env variables

8. Invoking Shell w/ Env. Variable

9. rsh and SHELL env variable

10. env variables between shells


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software