Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Syntax Question
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Syntax Question

BellaBella Member
edited August 2014 in Help

I'm still a newbie at this.

I have a file called setup.sh

ipaddr=curl getipaddr.net -s | head -n 1

secret=''blah"

radiusip='YOURRADIUSIPHERE'

echo "$radiusip $secret" >> /etc/ppp/options.pptpd

What I want it to do is add

11.55.22.66 blah to /etc/ppp/options.pptpd

But what ends up happening is it adds

$radiusip $secret

instead of the actual value of those variables.

Can someone help me.

Comments

  • I can tell you that

     ipaddr=curl getipaddr.net -s | head -n 1 

    should be

     ipaddr=`curl getipaddr.net -s | head -n 1` 

    The ticks puts the results of that command into the variable ipaddr.

    #!/bin/bash
    secret="blah"
    radiusip='YOURRADIUSiphere'
    
    echo "$secret $radiusip" >> testFile
    

    definitely works.

  • @black said:

    Be aware that in markdown syntax the back tick will be displayed as pre tag.

    ipaddr=`curl getipaddr.net -s | head -n 1`

    displays as

    ipaddr=curl getipaddr.net -s | head -n 1

    And to be honest I couldn't find any problem in the given script.

Sign In or Register to comment.