This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script Name: powerssh | |
# Version: 1.0.0 (24. June, 2014) | |
# Author: Sveinn Steinarsson | |
# Description: Use Powershell to connect to a remote server via SSH and run a shell script/command | |
# Prerequisite: | |
# plink.exe in script path (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) | |
# Examples: | |
# With key file (*.ppk) and script file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SEPARATOR = "\t" | |
QUOTE = "\"" | |
NEWLINE = System.getProperty("line.separator") | |
def record(values, valueToString) { | |
values.eachWithIndex { value, idx -> | |
def str = valueToString(value) | |
def q = str.contains(SEPARATOR) || str.contains(QUOTE) || str.contains(NEWLINE) | |
def n = str.isNumber() | |
OUT.append(q ? QUOTE : "") |