Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Thu Jun 29, 2017 11:05 am


Tips & Tricks, Questions regarding shell scripts, awk, perl, sed and much more.

Author Message
icvallejo
Post  Post subject: How to use $variable in conditional sentences?  |  Posted: Wed May 17, 2017 4:01 am
 

How to use $variable in conditional sentences?

Hello all

I am doing a Makefile but I can't return the value of $var to use it in conditional sentences:

Code:
#!/bin/sh

GO=$(shell) go
GOPATH=$(GO) env GOPATH

make:
    @$(GOPATH)
    @if [ ! -d "$(GOPATH)/bin" ]; then mkdir -p "$(GOPATH)/bin" ; fi


When I type "make", @$GOPATH returns
Code:
/home/icvallejo/go
so it's ok, but after, I don't know how to use it (I can't do it) with 'if' condition, make returns this:

Code:
if [ ! -d " go env GOPATH/bin" ] ; then mkdir -p " go env GOPATH/bin" ; fi


Can you help me please?





Top
Display posts from previous:  Sort by  
E-mail friendPrint view
Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO