Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

How to use $variable in conditional sentences?
https://forum.ivorde.com/how-to-use-variable-in-conditional-sentences-t19940.html
Page 1 of 1

Author:  icvallejo [ Wed May 17, 2017 4:01 am ]
Post subject:  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?

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/