Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help to create a function for a simple bash scrip

6 views
Skip to first unread message

Manoj Chander

unread,
Sep 28, 2020, 7:55:22 AM9/28/20
to
i want make the below snippet a function ,but when im exporting values of file mx.env and if i pass them to a function it is not picking it up it printing empty value .

for example:
getjar {
echo $1
echo "$1"
curl https://my.com:$1.jar
}

getjar "javaprocess1"
it prints empty value .i tried to use source instead of export still i get same result.



more detailed script content
echo "Export Env Variables "

export $(cat ../env/mx.env | sed 's/#.*//g' | xargs)

curl -L -X GET https://company.com/repository/{javaprocess_TAG}.jar --output javaprocess.jar

nohup java -jar javaprocess.jar

#######################################################

my env file
cat ../env/mx.env
javaprocess1_TAG=7.0.0.0.9
javaprocess2_TAG=7.0.0.0.8
javaprocess3_TAG='7.0.0.0.5'
0 new messages