在jenkins pipeline上执行脚本
def removePath = "/home/ljx/*jar" echo removePath sh "/bin/rm -f ${removePath}"
执行结果
/home/ljx/*jar /bin/rm -f '/home/ljx/*jar'
被加了单引号,执行成功但没有生效,通配符加\转义也会被加上单引号
def removePath = "/home/ljx/*jar" echo removePath rm -r $removePath