shell

Jenkinsfile: permission denied when running sh step in Docker container

久未见 提交于 2021-02-06 20:49:56
问题 I have trouble running a simple Jenkinsfile - e.g. pipeline { agent { label 'ssh-slave' } stages { stage('Shell Test') { steps { sh 'echo "Hello World"' } } } } The logfiles of Jenkins on the master show that the container was started successfully but the build job crashes with a message like sh: 1: /home/jenkins/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied Here are some additional things that we configured / figured out: We are running the agent on a VM with RHEL We

Jenkinsfile: permission denied when running sh step in Docker container

此生再无相见时 提交于 2021-02-06 20:43:47
问题 I have trouble running a simple Jenkinsfile - e.g. pipeline { agent { label 'ssh-slave' } stages { stage('Shell Test') { steps { sh 'echo "Hello World"' } } } } The logfiles of Jenkins on the master show that the container was started successfully but the build job crashes with a message like sh: 1: /home/jenkins/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied Here are some additional things that we configured / figured out: We are running the agent on a VM with RHEL We

ANSI questions: “\x1B[?25h” and “\x1BE”

独自空忆成欢 提交于 2021-02-06 19:56:56
问题 What does "\x1B[?25h" do? How is "\x1BE" different from "\n" ? According to http://ascii-table.com/ansi-escape-sequences-vt-100.php it " moves to next line "? Seems like that's what "\n" does? I tried echo "xxx\nxxx\n" and echo "xxx\x1BExxx\n" in PHP and they both output the same thing. Any ideas? Thanks! 回答1: These are ANSI escape sequences (also known as VT100 codes) are an early standardisation of control codes pre-dating ASCII. The escape sequence \x1BE , or Esc + E , is NEL or "Next line

First character of a variable in a shell script to uppercase?

这一生的挚爱 提交于 2021-02-06 15:29:33
问题 I have a shell script that starts unit tests for modules. I need the name of the module in all lowercase and with the first character uppercase. So far I have been doing it like this: #!/bin/sh -x # z.B. getbrowser strModuleToTest=$1 # g strModuleToTestUppercaseFirstletter=${strModuleToTest:0:1} # etbrowser strModuleToTestUppercaseLastletters=${strModuleToTest:1} # g -> G strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/a/A}" strModuleToTestUppercaseFirstletter="$

Can't use nvm from bash script

好久不见. 提交于 2021-02-06 15:28:42
问题 I am trying to write a shell script to automate my dev environment set-up (install python, nvm, node, mongo etc...). I am using nvm to install Node. It tells you to close and reopen your terminal to start using the nmv command. I tried to source .bashrc and .profile to make the command available right away so I can continue running the script with nvm install, but it doesn't work. Here is the segment of my script related to installing NVM / Node: #install nvm and latest node version #

Can't use nvm from bash script

时光毁灭记忆、已成空白 提交于 2021-02-06 15:27:31
问题 I am trying to write a shell script to automate my dev environment set-up (install python, nvm, node, mongo etc...). I am using nvm to install Node. It tells you to close and reopen your terminal to start using the nmv command. I tried to source .bashrc and .profile to make the command available right away so I can continue running the script with nvm install, but it doesn't work. Here is the segment of my script related to installing NVM / Node: #install nvm and latest node version #

First character of a variable in a shell script to uppercase?

蓝咒 提交于 2021-02-06 15:26:53
问题 I have a shell script that starts unit tests for modules. I need the name of the module in all lowercase and with the first character uppercase. So far I have been doing it like this: #!/bin/sh -x # z.B. getbrowser strModuleToTest=$1 # g strModuleToTestUppercaseFirstletter=${strModuleToTest:0:1} # etbrowser strModuleToTestUppercaseLastletters=${strModuleToTest:1} # g -> G strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/a/A}" strModuleToTestUppercaseFirstletter="$

How to shave off last character using sed?

六眼飞鱼酱① 提交于 2021-02-06 14:49:23
问题 That is, going from ABCD -> ABC 回答1: You can try: sed s'/.$//' The regex used is .$ . is a regex meta char to match anything (except newline) $ is the end of line anchor. By using the $ we force the . to match the last char This will remove the last char, be it anything: $ echo ABCD | sed s'/.$//' ABC $ echo ABCD1 | sed s'/.$//' ABCD But if you want to remove the last char, only if its an alphabet, you can do: $ echo ABCD | sed s'/[a-zA-Z]$//' ABC $ echo ABCD1 | sed s'/[a-zA-Z]$//' ABCD1 回答2:

How to shave off last character using sed?

ぃ、小莉子 提交于 2021-02-06 14:49:11
问题 That is, going from ABCD -> ABC 回答1: You can try: sed s'/.$//' The regex used is .$ . is a regex meta char to match anything (except newline) $ is the end of line anchor. By using the $ we force the . to match the last char This will remove the last char, be it anything: $ echo ABCD | sed s'/.$//' ABC $ echo ABCD1 | sed s'/.$//' ABCD But if you want to remove the last char, only if its an alphabet, you can do: $ echo ABCD | sed s'/[a-zA-Z]$//' ABC $ echo ABCD1 | sed s'/[a-zA-Z]$//' ABCD1 回答2:

Bash variables: case sensitive or not?

点点圈 提交于 2021-02-06 14:21:38
问题 Is bash shell scripting case sensitive? Is variable date the same as DATE ? 回答1: Yes, it is case sensitive, just like the rest of UNIX. $date and $DATE are two different variables. makefile and Makefile are two different files. -h and -H are two distinct flags (usually). 来源: https://stackoverflow.com/questions/15571706/bash-variables-case-sensitive-or-not