Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
6 events
when toggle format what by license comment
Jan 3, 2018 at 15:31 history edited itChi CC BY-SA 3.0
Further updates to OP request
Jan 3, 2018 at 14:34 comment added itChi This code is not very clear, for example you need spaces when using if [ ${TARGET_ENVIRONMENT}=it ] otherwise you are just setting TARGET_ENVIRONMENT Variable. Can you edit your post with your full code?
Jan 3, 2018 at 14:34 comment added tomix86 @sudhir please format this properly so that we can help you.
Jan 3, 2018 at 14:27 history edited itChi CC BY-SA 3.0
Added OP's format answer in reply. Removed subshell variables.
Jan 3, 2018 at 14:19 comment added sudhir i have removed paranthesis.But still i couldnt able to fetch ENV_NODE value in second function scpTAR set -x MASTER_HOSTNAME=hostname | cut -d . -f1 TARGET_ENVIRONMENT=it evaluateEnvProp(){ if [ ${TARGET_ENVIRONMENT}=it ]; then ENV_NAME=it && ENV_NODE=1cf62108e084 fi } scpTAR() { echo ENV_NODE if [ ENV_NODE==${MASTER_HOSTNAME} ] ; then echo "scpTAR ENV_NODE = ${MASTER_HOSTNAME} " else "echo 'scpTAR ssh other node than jenkins server ENV_NODE=${MASTER_HOSTNAME}'" fi } main(){ scpTAR } main
Jan 3, 2018 at 10:43 history answered itChi CC BY-SA 3.0