curl --noproxy "*" http://www.stackoverflow.comvi ~/.curlrc
noproxy=*
proxy=yourproxy.com:8080
curl --noproxy "*" http://www.stackoverflow.com#!/bin/bash
firstString="I love Suzi and Marry"
secondString="Sara"
echo "${firstString/Suzi/$secondString}"
# prints 'I love Sara and Marry'EXAMPLE 2:
URL="http://hostname/project/branches/Old_Branch/package"
SRC="Old_Branch"
REP="New_Branch"
echo "${URL/$SRC/$REP}"
## declare an array variable
declare -a arr=("element1" "element2" "element3")
## now loop through the above array
for i in "${arr[@]}"
do
echo "$i"
# or do whatever with individual element of the array
done
# You can access them using echo "${arr[0]}", "${arr[1]}" alsoThis snippet on the Advanced Bash Scripting Guide says:
# The == comparison operator behaves differently within a double-brackets
# test than within single brackets.
[[ $a == z* ]] # True if $a starts with a "z" (wildcard matching).
[[ $a == "z*" ]] # True if $a is equal to z* (literal matching).string='My long string'
if [[ $string == *"My long"* ]]; then
echo "It's there!"
fi
You can use the += operator to append to an array.
args=()
for i in "$@"; do
args+=("$i")
done
echo "${args[@]}"The Groovy script you provided is formatting the first line as a blank line in the resultant script. The shebang, telling the script to run with /bin/bash instead of /bin/sh, needs to be on the first line of the file or it will be ignored.
So instead, you should format your Groovy like this:
stage('Setting the variables values') {
steps {
bash '''#!/bin/bash
echo "hello world"
'''
}
}if(members){
//Some work
}
def exists = fileExists 'file'
if (exists) {
echo 'Yes'
} else {
echo 'No'
}