Find the answer to your Linux question:
Results 1 to 3 of 3
I have 3 files. setvariables.sh unprocessed.txt process.sh setvariables.sh just contains a list of export variables, that's all. unprocessed.txt is an "unprocessed" file full of undefined variables. I want process.sh to ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    1

    Substituting variables in cat output

    I have 3 files.
    setvariables.sh
    unprocessed.txt
    process.sh


    setvariables.sh just contains a list of export variables, that's all.

    unprocessed.txt is an "unprocessed" file full of undefined variables.

    I want process.sh to first execute setvariables.sh, then cat (or whatever would make this work) the unprocessed.txt file outputting a processed file with the variable definitions from setvariables.sh

    This has to be easy... any ideas?

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    You could try something like:
    Code:
    . ./setvariables.sh
    TEXT=$(<unprocessed.txt)
    eval echo "$TEXT"
    No idea if it'll work - but it might give you some clues, at least.

  3. #3
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    Maybe you can use parameter substitution?
    Can't tell an OS by it's GUI

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...