I have the following shell file that contains this:
sh
nightlyTag() {
echo $1-alpha.$(date +%Y%m%d).$(($(date +%s%N)/1000000))
}
yarnPubCanaryVersion() {
if [ -z "$1" ]
then
echo "No version argument supplied, maybe you meant v1.0.0?"
return 1
fi
version=`nightlyTag $1`
yarn version --new-version $version --no-git-tag-version
npm publish --tag canary
git reset --hard HEAD
}
I make the file executable with chmod +x canary.sh
, then I run it doing ./canary.sh
then my terminal changes to sh-3.2$
then I try to run the functions in the terminal like this nightlyTag
and I get
sh: nightlyTag: command not found
Same for yarnPubCanaryVersion
.
I was looking at this SO question