Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am executing below script but i get an error "line 14: last-tag=TSTA-6: command not found" i.e. at the point i try to store the command output in variable (TSTA-6 is output of command). Any ideas where am i going wrong?

#!/bin/bash

echo "This script will remote trigger tagging job. Kindly provide Inputs"

release=-1

if [ -z "$1" ];then
 echo "Enter release number [In 3 digit format i.e. 20.0.0] "
 read release
else
 release="$1";
fi

 last-tag=$(svn ls -v https://abc.com/tags | sort -k1 | tail -1 | tr -s ' ' | cut -d' ' -f7 | cut -d'/' -f1)  
echo "release is: $last-tag "
share|improve this question
3  
try lasttag instead of last-tag. – Archemar 2 days ago
up vote 7 down vote accepted

The shell is looking for a command called last-tag=TSTA-6 because "last-tag" is not a valid variable name, so once the shell sees the dash - in last-tag, the shell begins to look for a command. As in the comments, change last-tag to a valid variable name such as lasttag or last_tag.

share|improve this answer
    
Thanx a lot. It resolved the issue. – Lokesh 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.