'Whitespace in Jenkins global path variable

We have path name with whitespace and dash Like this //sharename\TEST - PATH

Jenkins installed on windows server with git bash

If i add this path to global environment Jenkins cut end of path like this

//sharename\TEST
touch: setting times of '-': Invalid argument
PATH

I know i can escape it in bash using quotes.But I need to escape it every time.

Maybe exist better way to deal with it?



Solution 1:[1]

When using the variable, use it as "$var" instead of $var.

See below code for example:

var="abc - 123"

# creates three folders: abc,-,123
mkdir $var

# creates a single folder named: abc - 123
mkdir "$var"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arun Kumar B