156,863 questions
-2
votes
0
answers
64
views
Github Runner on arm64 started breaking on apk add bash post-install [closed]
I am having an issue with the github runner for arm64 which stated to break for my previously fine DOCKER build.
The issue is the following :
#37 ERROR: process "/dev/.buildkit_qemu_emulator /bin/...
-5
votes
0
answers
84
views
Copy files and preserve some part of the folder structure [closed]
This question is regarding a basic bash script copying files.
I have the source folder structure as below.
folder1/folder2/folder3/folder4/folder5/text.txt
The destination folder structure is ...
-3
votes
0
answers
96
views
How systemd service will interpret sleep when the PC is turned off? [closed]
I have a script that does three things in a loop:
Do one thing when started
Wait one day (sleep 1d) and then do this thing again
Repeat while the processname is active
A quick example based on a ...
2
votes
1
answer
132
views
Bash date calculates time addition incorrectly
I am writing a simple bash script for computing time and date by adding seconds onto a random date that I give. It worked fine so far but going from 2016-03-13 00:00:00 to 2016-03-13 03:00:00 skips ...
0
votes
0
answers
79
views
keyboard backlight script not working well [closed]
Environment: Ubuntu 24
I'm trying to create a bash script to turn on/off the backlight after a period of time keyboard if no key is pressed.
It's working when I run it by hand, but when I try to run ...
0
votes
0
answers
99
views
Why does this bash script not execute the commands sequentially? [duplicate]
Given:
#!/bin/bash
set -x
cat <<EOF | while IFS= read -r LINE; do "${LINE}"; done
/usr/bin/bash
pstree -u "${USER}"
EOF
It outputs:
$ ./cat_while_bash.sh
+ cat
+ IFS=
+ read ...
3
votes
3
answers
118
views
Reading desktop notifications from the command line. Debian/Ubuntu
Running Ubuntu 24.04lts.
NOTE: I am trying to read the notification sent by he Discord app to my personal desktop notifications. When I notification from a specific sender, with a specific message, I ...
0
votes
1
answer
61
views
"...SSH Permission denied (publickey,password,keyboard-interactive)" when running python script as service on raspi [closed]
I have a python script that runs as a service on raspi, the script executes a bash script which then connects to a windows pc via SSH using a key.
I have successfully use the same code to connect to ...
2
votes
1
answer
56
views
GRUB audit script always fails on Ubuntu even after remediation (AppArmor parameters not detected)
I am trying to implement a CIS hardening rule on Ubuntu that requires every GRUB linux entry to include:
apparmor=1
security=apparmor
Audit script
#!/bin/bash
if grep "^\s*linux" /boot/grub/...
Best practices
3
votes
2
replies
94
views
How to efficiently bulk download from the internet archive
I want do download certain search results from the internet archive. I would like that the names of the resulted files and directories to be the title of the work -- idealy YYYY_<author>_<...
-1
votes
1
answer
112
views
How to give root access to Java Runtime Process? [closed]
I am trying to run a bash command through Java.Runtime.exec(), specifically coredumpctl.
I am only able to run the command on a bash terminal when I login as a root user, and this doesn't seem to be ...
2
votes
1
answer
172
views
How to do nothing with "for in" in Bash? [closed]
for in in Bash is setting variable. I need only the variable itself from this command.
for VAR in FILE*; do
something (hate it)
done
I plan to use this variable later, not in the block itself. Just ...
Best practices
1
vote
10
replies
182
views
Bash tool/function to replace an arbitrary literal string (not regex) in a file/variable
I want to write a small tool or Bash snippet that can be used like:
tool key value file
and it should replace all occurrences of key in file with value.
I tried:
sed -i "s/${key}/${value}/g"...
Advice
0
votes
1
replies
54
views
How modify script with adding second task?
This script adds a line to add custom.js to vivaldi browser directory:
#!/bin/bash
vivaldi=/opt/vivaldi/resources/vivaldi
moddir=$HOME/vivaldi-modding/
sudo cp $moddir/custom.js $vivaldi
sudo sed -i -...
6
votes
4
answers
162
views
awk command to subtract constant from a column and print results
I was working on a one-liner to subtract a constant value (e.g. 100 in this case) from a specific column using awk. So far I can manage to get to where I can print the last iteration only – which ...