All Questions
20 questions
0
votes
1
answer
749
views
declare: not found error in Jenkins pipeline
I have a Jenkins pipeline which has a step running a sh script. Something like this, but with more commands in between which are not relevant:
steps {
echo 'Running build with all ...
-2
votes
1
answer
187
views
Automate "atlasvpn connect"
I want to connect to a server through AtlasVPN automatically. But I have some difficulties to create a code that works at the startup of my Ubuntu system. Look at how that company's script works and ...
1
vote
1
answer
56
views
Process name as the called executable, not the calling script
Edit: I relalised after posting the below that the machine where this 'worked' had in fact not been restarted and the running processes had been launched using an older scheme of actual aliases (...
3
votes
3
answers
949
views
Use xargs and kill in script with optional signal
A script for terminating a server on a certain port:
#!/bin/bash
PORT="$1"
SIGNAL="$2"
if [ "${SIGNAL}" != "" ]; then SIGNAL=" -${SIGNAL}"; fi
lsof ...
1
vote
3
answers
132
views
How to convert add x days onto a var in bash
I have a file that contains many lines like the following :
0 D FakeSip 192.169.192.192 jan/26/2022 17:10:31
I want to export the ip address, the date then add say 10 ...
2
votes
2
answers
11k
views
Update `.bashrc` and reload
I have a script that inserts some lines to the bottom of my .bashrc, is there a way to source the .bashrc from within the script so that these changes remain once the script has finished? Here's an ...
0
votes
2
answers
2k
views
how to run script automatically when certain applications are opened
i want to run a bash script whenever i open vlc
i tried to put the alias of vlc to my script and open vlc but this only works when opened from terminal i want my script to run even when vlc is opened ...
0
votes
0
answers
51
views
who to change text after a specific sentance
hi i get this file /lib/systemd/system/vsftpd.service
i when to change something in this line
ExecStart=/usr/sbin/vsftpd /etc/vsftpd_conf/blablabla/vsftpd.conf
i want to replace after vsftpd_conf/ ...
0
votes
1
answer
1k
views
How to add a text file into a bash script then work with that text file
I need to read into my script 3 parameters, the first 2 are numbers and the third one is a .txt file.
For example:
example.sh 3 2 exam.txt
And with the third parameter exam.txt that already has some ...
2
votes
1
answer
735
views
"grep -Ff " doesn't highlighted pattern with colour in bash script
while running below command in terminal it's working fine with highlighted red and white colour matching with the pattern as per image below,
$ grep -Ff file1.txt file2.txt
Output:
But when I put the ...
0
votes
1
answer
33
views
Killing jobs submitting from an exited bash script
I wrote a bash script that submits a bunch of background jobs and then exits. I realized that I ran with the wrong input and they'll run for way too long. Is there a way for me to kill these jobs from ...
0
votes
2
answers
390
views
Error when running script involving machine name and local network
I'm trying to write a script that takes a machine name as a command line argument and displays a message informing me whether the host is on the local network.
Here's what I have:
#!/bin/bash
...
0
votes
1
answer
103
views
How do we terminate screen sessions based on their attached or detached properties or their IDs?
The problem:
We accidentally created close to 80 screens while running an experiment.
We could terminate them one by one using their IDs. But, is there a way to end them all using a script or a ...
1
vote
1
answer
2k
views
Bash Script Case statement (if-not logic)
I wrote a small bash script. It will try to find the word ERROR. If found the resulting value will be non-zero numeric (for example 25. I mentioned in the script but it is variable numeric value), and ...
1
vote
1
answer
990
views
No such file, but file is just created [duplicate]
I've got a bash script in which i create a file and append to it.
Problem is when I try to write to it, the shell tells me
/home/username/bin/myscript: line 62: ~/Desktop/folder/filename: No such ...