Questions tagged [bash]

Most common system shell in Unix/Linux environments. Integrates very well with other softwares having a command line interface. Widely used in CI scripts and buildscripts.

The shell is developed since 1988 by the Free Software Foundation.

In the decades, it has got most features of a high-level programming language, including exception handling, high-level data structures inculding dictionary and arrays, while it still preserved its close connection to the low-level OS functionality.

Its main purpose in the CI/DevOps world is to integrate the command-line interfaces of different softwares to each other.

43 questions
18
votes
1 answer

How to keep configuration files automatically during apt-get upgrade or install?

When performing and apt-get update; apt-get upgrade -y on a server I encountered the message: Setting up sudo (1.8.16-0ubuntu1.5) ... Configuration file '/etc/sudoers' ==> Modified (by you or by a script) since installation. ==> Package distributor…
Steven K7FAQ
  • 666
  • 1
  • 5
  • 13
7
votes
2 answers

Defining and using bash functions in AWS CodeBuild

I thought I could slightly improve readability of repetitive sed calls when inserting secrets into a file with AWS CodeBuild. I defined a bash function: replaceConfig() { sed -i 's|{'$1'}|'${!1}'|' config.json; } This can be called like…
Kyle
  • 171
  • 1
  • 3
5
votes
3 answers

How to pass Gitlab env var with sensitive characters to bash script?

I have the following situation: I'm storing sensitive data in Gitlab's environment and then passing these variables to a deployment script in bash. Gitlab's env var: Key: sensitive_var Value: aaa$bbb*% Then in the .gitlab-ci.yml file the env vars…
JJ Yong
  • 53
  • 1
  • 1
  • 4
5
votes
2 answers

Interference of Docker CMD with su: works with su-exec but not with su?

In this bash script under Linux Alpine they have (line 8): exec su-exec "$ZOO_USER" "$0" "$@" As far as I know, su-exec is however an Apache httpd dependecy - can I avoid it installing it under Ubuntu and use some more plain alternative? I have…
Ta Mu
  • 6,792
  • 5
  • 43
  • 83
4
votes
5 answers

Access vault secret from bash script

I am looking for help on a direction on where to go from here. I have a Hasicorp Vault server running and accessible over DNS (local). I need to have a script get a secret from it then use that secret. I am not sure where to go from there. I know I…
user8517
4
votes
1 answer

Exit a Makefile target called by parent without throwing an error

Let's say that I have 2 targets: test: # ... @$(MAKE) dosomething @echo test # ... dosomething: # ... @if [ -z "$(SOMETHING)" ]; then exit 0; fi @echo dosomething # ... I would like echo test to execute even if…
Destroy666
  • 141
  • 1
  • 4
3
votes
1 answer

npm not found but installed from the shell script file in Dockerfile

I have a following Dockerfile: FROM ubuntu:18.04 RUN mkdir app && cd app WORKDIR app/ RUN apt-get update && apt-get install -y \ software-properties-common \ curl \ sudo \ && curl -O…
Leon Ma
  • 33
  • 1
  • 1
  • 4
3
votes
1 answer

Jenkins hangs on Windows CMD build that has GUI

I am attempting to automate imports and exports of Oracle's PeopleSoft Application Designer. It is a GUI program but it can operate in the windows command line for certain tasks. This project has examples of how it is used in the command line. The…
Stoopkid
  • 141
  • 3
3
votes
1 answer

docker: Error response from daemon: Conflict. The container name "/basexhttp" is already in use by container

Am I even correctly following the documentation on creating and running a docker container below? [root@ ~]# [root@ ~]# docker run -d \ > --name basexhttp \ > --publish 1984:1984 \ > --publish 8984:8984 \ > --volume…
Nicholas Saunders
  • 375
  • 3
  • 12
  • 22
2
votes
1 answer

Bash Tokenization Errors on Jenkins JNLP Slave

Why might the below bash commands give me an error on a Jenkins JNLP slave in Kubernetes cluster? Each work on a local machine. Error: Syntax error: redirection unexpected IFS='/' read -r -a branch <<< "${1}" Error: Syntax error: "(" unexpected…
2
votes
1 answer

Automating the creation of an Apache virtual-host file specifically

When I create new web applications on my up-2-date Ubuntu-LAMP with Apache 2.4.x environment, I create their virtual-host files this way: s_a="/etc/apache2/sites-available/" s_e="/etc/apache2/sites-enabled/" read -p "Have you created db credentials…
user5176
2
votes
1 answer

How to make the Jenkins agent build then start the server?

I want the Jenkins agent to build and start the server. I do this by specifying how to build and start the server in the Build step of the project configuration in Bash echo "Installing dependencies" npm install echo "Starting…
Tran Triet
  • 879
  • 3
  • 11
  • 21
2
votes
1 answer

How to modify/allow firewall rules of a GCP instance directly from the CLI?

Is there anyway to allow the ports from CLI? I have an instance in GCP and I have installed a service which by default runs on Port:8080. I know there is an option to change the firewall rules to allow ports from the GCP dashboard but I'm wondering…
AV Reddy
  • 101
  • 10
2
votes
1 answer

ansible Unsupported parameters for (command) module:

I'm trying to run a shell command in an ansible task but I keep getting an error. This is the task item and the shell command I want to run: - name: Set File Watch Limit ansible.builtin.shell: cmd: "echo fs.inotify.max_user_watches=524288 |…
learningtech
  • 161
  • 1
  • 8
2
votes
1 answer

Why does Jenkins Pipeline script returnStatus value not match status examined in shell?

This is my little newbie Groovy script, trying to cobble together a very beginner understanding of Jenkins Pipelines: node { stage("hello") { def var = "val" echo "${var}" def stdout = sh( script: 'pwd', returnStdout: true ).trim() echo…
StoneThrow
  • 179
  • 1
  • 3
  • 11
1
2 3