Display variables in CAT area


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Display variables in CAT area
# 1  
Old 06-25-2009
Display variables in CAT area

Hi All,

I've got a script to output YAML data, and I want to display data that's held inside variables inside one large CAT area. What's the easiest way to do this?

Code:
cat << "END"
---
classes:
        - general_image
        - $intro      #Variable 1
        - $mid       #Variable 2
        - $doubled  #Variable 3
parameters:
        puppet_server: testing.huronhs.com
END
exit 0

I've tried referencing the variables this way, and tried using the backtick ` or brackets, but nothing exports the data held in the variables (just the string of "$intro" itself).
# 2  
Old 06-25-2009
loose the quotes around END:
Code:
     << [-]word
           The shell input is read up to a line that is the  same
           as word, or to an EOF. No parameter substitution, com-
           mand substitution, or file  name  generation  is  per-
           formed  on  word.  The  resulting  document,  called a
           here-document, becomes  the  standard  input.  If  any
           character  of  word  is  quoted,  no interpretation is
           placed upon the characters of the document. Otherwise,
           parameter  and command substitution occur, \NEWLINE is
           ignored, and \ must be used to quote the characters \,
           $,  `,  and  the  first  character  of  word.  If - is
           appended to <<, then all  leading  tabs  are  stripped
           from word and from the document.

# 3  
Old 06-25-2009
D'OH!

Why do I always do this to myself...

Thanks for the polite RTFM! Cheers!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cat command not working to display Mac file in Ubuntu

Hi, Recently I got a .txt file from Mac user. when I try to open it in my Ubuntu machine using cat command it is not displaying any content of file however I can see the content using vi. Anyone know How to see its content using cat as I have to process it in my shell script. Thanks in... (4 Replies)
Discussion started by: diehard
4 Replies

2. UNIX for Dummies Questions & Answers

Cat and variables

I've been having trouble with cat and variables. If I do the following: var1=filex cat $var1 I get the contents of the file named filex If I do var2="X-0101\ 2-10-2013.txt" cat "$var2" I get cat : cannot open X-0101\ 2-10-2013.txt. I have tried to do cat $var2 without quotes as... (8 Replies)
Discussion started by: newbie2010
8 Replies

3. Shell Programming and Scripting

Script with ^M causes display issue with cat or more

I have a script to do a couple simple but repetitive commands on files that are provided to us. One of the things is to get rid of the line feeds. This is the section that is causing problems, i even cut this section into its own file to make sure nothing else was affecting it. #!/usr/bin/bash... (4 Replies)
Discussion started by: oly_r
4 Replies

4. UNIX and Linux Applications

display correctly variables with a \

Hi, We are in AIX 5.3 In a shell program I use a variable coming from a file and containing a path : 'C:\temp\titi' Z2='C:\temp\titi' echo $Z2 When I want to print the variable with echo command , I have : C: emp iti How to have the correct variable ? Thanks (1 Reply)
Discussion started by: tbeghain
1 Replies

5. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

6. UNIX for Dummies Questions & Answers

How to Display a range of values in the output of cat

When I use this command I get an output of some numbers cat ac.20070511 | cut -d" " -f19 Is there any way for me to display only the numbers that are greater than 1000 but not all the numbers in the ouput. Can any one help me with this. :) (8 Replies)
Discussion started by: venu_nbk
8 Replies

7. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies

8. UNIX for Dummies Questions & Answers

using cat and grep to display missing records

Gentle Unix users, Can someone tell me how I can use a combination of the cat and grep command to display records that are in FileA but missing in FileB. cat FileA one line at a time and grep to see if it is in fileB. If it is ignore. If line is not in fileB display the line. Thanks in... (4 Replies)
Discussion started by: jxh461
4 Replies

9. Shell Programming and Scripting

cat setting variables

hi All I have a file that has 4 lines: 1. yesterday's date (mm/dd/yyyy) 2. yesterday's day- dd 3. yesterday's month- mm 4. yesterday's year- yyyy I want to read this file and place them in variables. how can I do this. Please help. thanks in advance!! KS (3 Replies)
Discussion started by: skotapal
3 Replies

10. UNIX for Advanced & Expert Users

multiple DISPLAY variables

Hi there, What I am trying to do is export the same screen to 2 different machines at once. I know you can use: DISPLAY=IP:0.0 export DISPLAY to send a screen to one machine but is there a way to send the screen to two machines at once by a similiar (or completely different, for that... (3 Replies)
Discussion started by: QUartz Ite
3 Replies
Login or Register to Ask a Question