Sponsored Content
Top Forums Shell Programming and Scripting How to use $variable in conditional sentences? Post 302997592 by icvallejo on Wednesday 17th of May 2017 04:35:46 AM
Old 05-17-2017
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 /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?

Last edited by rbatte1; 05-17-2017 at 05:51 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

spliting up sentences

hello, i'm looking to split up text into a list of words but can't figure it out, any help would be great. thanks steven (2 Replies)
Discussion started by: stevox
2 Replies

2. Shell Programming and Scripting

How to identify sentences from a text?

Hi, I have to identify sentences from this text. If i split these statements by this way: @sentence= split(/\.\W*/,$text); I will get these following things also in the output along with proper sentences. Biol Reprod. 2002 Mar;66(3):785-95. Egydio de Carvalho C, Tanaka H,... (2 Replies)
Discussion started by: vanitham
2 Replies

3. Shell Programming and Scripting

comparing sentences

Hi, I have a file and that file contains the following sentences. Here we show that a virus-encoded transcription factor, viral mRNA, cellular RNA-binding protein heterodimer G3BP/Caprin-1 (p137), translation initiation factors eIF4E and eIF4G, and ribosomal proteins are concentrated in the... (4 Replies)
Discussion started by: vanitham
4 Replies

4. UNIX for Dummies Questions & Answers

How to filter sentences??

Hi, I have few sentences here. $a1="Division of Hematology-Oncology, and Stem cell transplantation, Schneider Childrens Hospital, Albert Einstein College of Medicine, New Hyde Park, New York. "; $a2="Department of Cell Biology and Anatomy, College of Medicine, National Cheng Kung... (3 Replies)
Discussion started by: vanitham
3 Replies

5. Programming

Conditional Compilation based on Environmental Variable in Unix

I want to be able to access an environment variable to control how a program is compiled. So: export MY_VERSN=9 Then ideally, within my C++ code, I would have #if MY_VERSN = 9 iret = FRED9() #else iret = FRED() #endif The way I thought I could do it is that in the script that... (2 Replies)
Discussion started by: BrighterLater
2 Replies

6. Shell Programming and Scripting

set variable using 'ls' with an 'or' conditional statement

Hi, I would like to set a variable using ls, but I need to be able to list two possibilities simultaneously, i.e., I'd like to do this all on one line. These are the two possible directories, but keep in mind only *one* will be present at any given time: drwxrwxrwx 4 qtv qtv 16384 Nov 9... (5 Replies)
Discussion started by: goodbenito
5 Replies

7. Shell Programming and Scripting

awk conditional expression to compare field number and variable value

Hi, I'm trying to compare the value in a field to the value in a variable using awk. This works: awk '$7 == "101"'but this is what I want (and it doesn't work): value=101 awk '$7 == "$value"' Any help or insight on this would be great. Thanks in advance. (1 Reply)
Discussion started by: goodbenito
1 Replies

8. UNIX for Dummies Questions & Answers

extracting sentences that only contain a word

Hi guys Need your help how do I extract sentences with only a word i.e. today is hot hot very humid humid2 Sample output hot very (0 Replies)
Discussion started by: jamestan
0 Replies

9. Shell Programming and Scripting

extracting sentences that only contain a word

Hi guys Need your help how do I extract sentences with only a word i.e. today is hot hot very humid humid2 Sample output hot (6 Replies)
Discussion started by: jamestan
6 Replies

10. Shell Programming and Scripting

Using awk to find sentences.

I am trying to print out sentences that meets a regular expression in awk (I’m open to using other tools, too). I got the regular expression I want to use, "(\+ \{4\})" from user ripat in a grep forum. Unfortunately with grep I couldn't print only the sentence. While searching for awk... (8 Replies)
Discussion started by: danbroz
8 Replies
GO-REMOTE(7)						 Miscellaneous Information Manual					      GO-REMOTE(7)

NAME
go - tool for managing Go source code DESCRIPTION
An import path (see go-importpath(1)) denotes a package stored in the local file system. Certain import paths also describe how to obtain the source code for the package using a revision control system. A few common code hosting sites have special syntax: BitBucket (Mercurial) import "bitbucket.org/user/project" import "bitbucket.org/user/project/sub/directory" GitHub (Git) import "github.com/user/project" import "github.com/user/project/sub/directory" Google Code Project Hosting (Git, Mercurial, Subversion) import "code.google.com/p/project" import "code.google.com/p/project/sub/directory" import "code.google.com/p/project.subrepository" import "code.google.com/p/project.subrepository/sub/directory" Launchpad (Bazaar) import "launchpad.net/project" import "launchpad.net/project/series" import "launchpad.net/project/series/sub/directory" import "launchpad.net/~user/project/branch" import "launchpad.net/~user/project/branch/sub/directory" For code hosted on other servers, import paths may either be qualified with the version control type, or the go tool can dynamically fetch the import path over https/http and discover where the code resides from a <meta> tag in the HTML. To declare the code location, an import path of the form repository.vcs/path specifies the given repository, with or without the .vcs suffix, using the named version control system, and then the path inside that repository. The supported version control systems are: Bazaar .bzr Git .git Mercurial .hg Subversion .svn For example, import "example.org/user/foo.hg" denotes the root directory of the Mercurial repository at example.org/user/foo or foo.hg, and import "example.org/repo.git/foo/bar" denotes the foo/bar directory of the Git repository at example.com/repo or repo.git. When a version control system supports multiple protocols, each is tried in turn when downloading. For example, a Git download tries git://, then https://, then http://. If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a <meta> tag in the document's HTML <head>. The meta tag has the form: <meta name="go-import" content="import-prefix vcs repo-root"> The import-prefix is the import path corresponding to the repository root. It must be a prefix or an exact match of the package being fetched with "go get". If it's not an exact match, another http request is made at the prefix to verify the <meta> tags match. The vcs is one of "git", "hg", "svn", etc, The repo-root is the root of the version control system containing a scheme and not containing a .vcs qualifier. For example, import "example.org/pkg/foo" will result in the following request(s): https://example.org/pkg/foo?go-get=1 (preferred) http://example.org/pkg/foo?go-get=1 (fallback) If that page contains the meta tag <meta name="go-import" content="example.org git https://code.org/r/p/exproj"> the go tool will verify that https://example.org/?go-get=1 contains the same meta tag and then git clone https://code.org/r/p/exproj into GOPATH/src/example.org. New downloaded packages are written to the first directory listed in the GOPATH environment variable (see go-path(1)). The go command attempts to download the version of the package appropriate for the Go release being used. See go-install(1) for more. AUTHOR
This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others). 2012-05-13 GO-REMOTE(7)
All times are GMT -4. The time now is 01:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy