Questions tagged [shell-script]
Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.).
16,491
questions
1
vote
0
answers
17
views
mdadm in script produces nonsesnsical error when muting output to /dev/null
Some really weird Voodoo magic is going on with mdadm in my script:
Creating RAID with: mdadm --create --run --level=1 --metadata=1.2 --raid-devices=2 /dev/md/4 /dev/nvme1n1p4 /dev/nvme0n1p4
mdadm: /...
0
votes
2
answers
57
views
Regarding Nested loops
I had 3 array array1, array2, array3 where array 3 is the value of first two array. for example: FO=2.0, FF=3.5, FC=4.5 and so on. I want to give k (third loop) values of array3, like while running FO ...
0
votes
1
answer
35
views
Get a list of all user's commands from a non-interactive shell
I am writing a script that would automatically suggest some new aliases/functions to be added to a user's shell config. Before doing that, however, I would like to make sure the aliases being ...
0
votes
1
answer
29
views
Linux Shell Script replace last shown lines at the screen, not write it under the last once
i run a script from bring formated numbers to the screen :
#!/bin/sh
while true ; do
echo
awk -v x=987654321 -v n=8 'BEGIN{srand(); while (--n) {$++NF = int(rand() * x / n); x -= $NF}; $++NF =...
0
votes
1
answer
48
views
join a specific number of files/devices in linear mode together in a linux system
For joining in Linux files/devices in linear mode together i have this script dm-joinlinear.sh from
join files/devices in linear mode together in a linux system , thanks telcoM
#!/bin/sh
usage() {
...
0
votes
1
answer
44
views
How can I get stderr from mbuffer written to log file when using tee?
Having a bash script that essential only doing:
mbuffer --md5 -i dummy.tar -o /dev/null
A user of this script wants to use tee and store the output messages in a log file.
./script.sh 2>&1 | ...
0
votes
1
answer
46
views
Use fallocate with numbers from text file
For testing i create at my Linux-System the file list.txt. In there are numbers like:
4 1 5 2 3
(sometime there are more or less numbers)
How do i run these numbers with fallocate?
fallocate -l ...
-3
votes
2
answers
79
views
Using awk, append a value in last field in csv file based upon value in specific field
input.csv -
"family_guy","Brian","b47f0a80-d848-4d81-a45b-7ba930e6048b","son"
"family_guy","Brian","b47f0a80-d848-4d81-a45b-...
0
votes
0
answers
22
views
Animating GIFs as previews in File Manager "LF" or "ranger"
The desired behavior: When I'm using a file manager "LF" I would like to have animated GIFs as previews when I am over an image/gif mime-type file.
What I actually had on mind was to convert ...
1
vote
3
answers
86
views
Can I make a script that Reboots and continues after?
I currently have a script that I want to run
#! /bin/bash
Echo “plotting chart”
systemd-analyze plot > boot.svg
wait
Echo “rebooting”
shutdown -r +1
sleep 180
Is there a way to edit this so the ...
2
votes
4
answers
825
views
How to POSIX-ly ignore "warning: command substitution: ignored null byte in input"?
Today, I was working with my Raspberry Pi 4 with Debian 12 Bookworm, and I found it odd, that some system text files, namely I needed these two:
/sys/firmware/devicetree/base/model
/sys/firmware/...
-1
votes
2
answers
92
views
runuser: execute commands without use of quotation marks?
Overview
I'm attempting to execute commands as a different user without using quotation marks as well as making sure the executed command isn't inheriting environment from the parent shell.
runuser ...
0
votes
0
answers
17
views
Run "scrot -" from Openbox
I'm trying to add a new keybinding to the rc.xml of my Openbox WM. The code is as follows:
<keybind key="Print">
<action name="Execute">
<command>scrot -s - ...
0
votes
0
answers
23
views
SLURM job script - why is the tmp local directory deleted before archiving can occur? How to prevent this?
I wrote a SLURM job script to run a computational chemistry calculation using the CREST program (part of the xtb software package). In the script, I create a temporary directory on the local storage ...
0
votes
2
answers
68
views
variable with hyphen in bash script
db1="community-service-data"
db2="ecomm-data-test"
drop_db="DROP DATABASE ${db1}"
sudo -u postgres -S /bin/bash -c "psql -U postgres -d postgres -c \"${drop_db}...