# .travis.yml before_script: - | set -e curl -L https://packagecloud.io/varnishcache/varnish60/gpgkey \ | sudo apt-key add - curl -L "https://packagecloud.io/install/repositories/varnishcache/ varnish60/config_file.list?os=ubuntu&dist=trusty&source=script" \ | sudo tee -a /etc/apt/sources.list sudo apt-get update -qq sudo apt-get install -qq varnish
# Dockerfile ... RUN curl -Lso libvmod-curl.tar.gz https://...libvmod-curl-1.0.4.tar.gz && \ tar xzf libvmod-curl.tar.gz && \ rm libvmod-curl.tar.gz && \ cd libvmod-curl-1.0.4 && \ sh autogen.sh && \ sh configure && \ make && \ make install && \ cd .. && \ rm -rf libvmod-curl-1.0.4 ...
# deploy.sh composer install --no-dev --prefer-dist --no-scripts \ --no-interaction --no-progress --no-suggest \ --ignore-platform-reqs sed -i -e "s/###LICENSEKEY###/${NEWRELIC_LICENSE}/g" \ newrelic/varnish-plugin/config/newrelic.json cf-deploy --manifest=${MANIFEST} --space=${CF_SPACE} \ --password="${CF_PASSWORD}" --app-check-path=/isalive \ --hook-dir=.deploy/hooks --additional-domains="${DOMAINS}" \ --cycle-app-guids
#!/usr/bin/env bash echo "Hello World!"
$ chmod a+x helloscript $ ./helloscript "Hello World!"
#!/usr/bin/env bash cd /tmp touch myfile echo "hello" > test.txt cat test.txt
$ ./demo hello $ ls /tmp myfile test.txt
#!/usr/bin/env bash set -x # output every line before executing foo=ls $foo echo $foo echo `$foo`
$ ./variables + foo=ls + ls data.dump notes.txt variables + echo ls ls ++ ls + echo data.dump notes.txt variables data.dump notes.txt variables
#!/usr/bin/env bash echo $MY_VAR
$ MY_VAR="hello" ./envvars hello
«Do one thing and do it well»
Douglas McIlroy,
Computer Pioneer
cat data.dump | sort -b | head -n 3 > output.txt
if [ condition ]; then <instructions> elif [ condition ]; then <instructions> else <instructions> fi
condition | [ ] | [[ ]] |
---|---|---|
file | évalue ? * | littéral |
string | [ -n "$var" ] | [[ -n $var ]] |
arithmetics | -lt -gt -eq -ne | < > == != |
bool logic | -a et -o | && et || |
# basic unix feature: return status code. # 0 means success # !0 indicates error do-something-that-might-fail if [[ 0 != $? ]]; then echo "An error happened!" fi
# abort script on error set -e # fail immediately if any piped commands fails set -o pipefail cat data.notfound | sort -b | head -n 3 # aborts after `cat`, rather than executing `sort` and `head`
#!/usr/bin/php echo "hello world";
$ chmod a+x script.php $ ./script.php hello world
#!/usr/bin/env bash echo $1
$ ./parameters my test my
# parent foo="foobar" ./child export foo ./child
# child echo "foo is $foo"
$ ./parent foo is foo is foobar
# parent foo="foobar" ./child export foo ./child
$ export foo=myvalue $ ./parent $ echo $foo
$ export foo=myvalue $ ./parent foo is foobar foo is foobar $ echo $foo myvalue
example() { local $MY = "some value" echo "My $MY function called with arg $1" } example "test"