Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| package main | |
| import ( | |
| "strings" | |
| "path/filepath" | |
| ) | |
| func fileNameWithoutExtension(fileName string) string { | |
| return strings.TrimSuffix(fileName, filepath.Ext(fileName)) | |
| } |
xhost + ${hostname} to allow connections to the macOS host *export HOSTNAME=`hostname`* environment:
| // Related to https://issues.jenkins-ci.org/browse/JENKINS-26481 | |
| abcs = ['a', 'b', 'c'] | |
| node('master') { | |
| stage('Test 1: loop of echo statements') { | |
| echo_all(abcs) | |
| } | |
| stage('Test 2: loop of sh commands') { |
| /* | |
| Watch out, os.IsExist(err) != !os.IsNotExist(err) | |
| They are error checkers, so use them only when err != nil, and you want to handle | |
| specific errors in a different way! | |
| Their main purpose is to wrap around OS error messages for you, so you don't have to test | |
| for Windows/Unix/Mobile/other OS error messages for "file exists/directory exists" and | |
| "file does not exist/directory does not exist" |
| #!/bin/bash | |
| # where to store the sparse-image | |
| WORKSPACE=~/Documents/workspace.dmg.sparseimage | |
| create() { | |
| hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 60g -volname workspace ${WORKSPACE} | |
| } | |
| detach() { |
| SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}` | |
| SCRIPT_DIR=`cd $SCRIPT_DIR && pwd` |
| def m = "1234 abc" =~ /^(\d+)/ | |
| def n = "abc 1234" =~ /^(\d+)/ | |
| println (m.find()?m.group():"not matched") | |
| println (n.find()?n.group():"not matched") | |