Ley Missailidis
Ley Missailidis

Reputation: 79

Variable Assignments in BASH

Reworded for better understanding.

I am customizing a git flow based plugin and I am trying to get the tail end of init to create a repo. I know all the commands to do it manually but for so reason I can't automate it.

REPO_NAME= `${PWD##*/}`
    echo $REPO_NAME
    ORG=':org_name'
    curl -u 'user:pass' \
      -d '{ "name": "'$REPO_NAME'",  "private": "true", "has_issues": "true", "has_wiki": "false", "has_downloads": "true"}' -i "https://api.github.com/orgs/$ORG/repos"

And no matter what I do to the command I always get this and curl fail.

/usr/local/bin/git-hf: 1: /usr/local/bin/git-hf: test-testy: not found

errors": [
{
  "code": "custom",
  "field": "name",
  "resource": "Repository",
  "message": "name is too short (minimum is 1 characters)"
}

], "message": "Validation Failed"

I know this is probably a stupid question but I am more concerned with the error in my logic here rather than the immediate solution.

Upvotes: 1

Views: 118

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185790

Just try doing this :

dir=${PWD##*/}
echo "$dir"

Upvotes: 1

Related Questions