Questions tagged [bash]
**** IMPORTANT NOTE: Do not ask a bash question until after you have copy/pasted your script into http://shellcheck.net and fixed all of the issues it tells you about. **** This tag is for questions about scripts written for the Bash command shell. Questions about the interactive use of Bash are more likely to be on-topic on Unix & Linux Stack Exchange or Super User than on Stack Overflow.
156,247
questions
0
votes
0
answers
27
views
Run certbot on centralised server to generate certificates manually [closed]
Overview:-
Developed a centealized custom api (.net) and deployed to nginx server to accept api request for generating a ssl certificate through api calls.
when a new request api call is made , I’m ...
1
vote
0
answers
69
views
exit status of if statement in bash when condition is false
If I run help if in bash then it tells me that the exit status is "the status of the last command executed". Let's try it:
if false; then
echo we never get here
fi
echo $?
The last ...
2
votes
3
answers
70
views
Using sed to remove differences in two arrays (updated ssh keys)
My aim is to updated automate the update of ssh keys in the authorized_keys file. Due to restrictions i am unable to use ansible which would have been a lot simpler.
Steps:
read keys from the file
...
0
votes
0
answers
27
views
Websphere Automation [closed]
I have a script which references a txt such as serverList.txt which has a list of linux servers where WAS is running and stops the nodeagent on them.
I'd like to add to the script where it stops the ...
-1
votes
5
answers
114
views
How do I delete all the lines that match and one after each of them?
I have a large file and a list of my specific strings. The output should not contain my specific lines and one more after each of them. 2 consecutive matches are impossible due to structure of file ...
0
votes
0
answers
27
views
In bash why does the increment operator set the exit code to 1 if the input is zero [duplicate]
In the following bash session you can see the ((cnt++)) sets the exit code to 1 if cnt is zero, but not if the initial value is anything else, why is this?
$ cnt=0
$ echo $?
0
$ ((cnt++))
$ echo $?
1
$...
0
votes
1
answer
43
views
How to use REST API to delete message on Azure Storage Queue in bash?
I would like to know how to delete a message on Azure Storage Queue. Currently I keep getting the following error.
<?xml version="1.0" encoding="utf-8"?><Error><Code&...
-2
votes
1
answer
46
views
running command when program crashes [duplicate]
I have a Minecraft server that runs on Ubuntu 24 and mincraft1.21.
Sometimes the Minecraft server file suddenly stops working and jumps back to the terminal.
How can I write a Bash program that when ...
0
votes
1
answer
37
views
Why does running a gzip command in combination with sponge in my Nextflow script produce an empty file?
I have a fairly simple nextflow process - it takes a file, does some simple processing, and uses sponge to write to the same file. At the end of the script, it uses gzip to compress the file. However, ...
1
vote
1
answer
45
views
How to run a bash script using bash using Docker-in-Docker
I have a bash script that I use to build my Docker images and I'm trying to set up my GitLab CI so that it automatically builds the image whenever I push a tag.
This is my .gitlab-ci.yml file:
stages:
...
0
votes
1
answer
27
views
Hadoop Truncating Strings at 256,512,1024 Characters Arbitrarily
this is my first post so apologies for any confusion. I am attempting to run a DNA sequence analysis through Map Reduce. Here are the important parts of my mapper.sh script:
while read line
do
...
2
votes
4
answers
73
views
How to change old date format in a file to a new format
I have a huge file, and it has around 200 lines like this:
started at Wed Jun 5 08:45:01 PM +0330 2024 -- ended at Wed Jun 5 10:35:34 PM +0330 2024.
started at Thu Jun 6 01:30:01 AM +0330 2024 -- ...
-1
votes
0
answers
19
views
--include option in grep working different in .bashrc method [duplicate]
When I run grep -ril --include "gokp*" "blah" . --exclude-dir=deployBuild from a bash shell I get the following output:
./general/dbprocs/gokpve1.sql
./general/dbprocs/gokpven.sql
....
0
votes
1
answer
53
views
How to evaluate 2 variables using bash arithematic in if statement with AND operator in bash shell [duplicate]
I have an alphanumeric string, say something like "XXXX24Y2" from which i have extracted only the numbers and assigned them to 2 variables, say num1 and num2, say num1=24 and num2=2
Now i ...
0
votes
2
answers
34
views
Autorun with boot Raspberry Pi 4
I have such a problem
I wrote python script and want to run it automatically with boot through shell script.
I tried to add this .sh file to crontab -e in such way:
@reboot /home/path/to/my_script.sh
...