All Questions
1,561 questions
0
votes
1
answer
67
views
Creating in Linux files in GB or MB range by various size by read a file
In Linux with Bash, there is the File numbers_in_one_line.
In this file there is only one line with several numbers, all separated by spaces.
These numbers are the value in bytes for creating files ...
0
votes
1
answer
86
views
How to create splittet random files and join them with dmsetup
In Linux in Bash, there is a script, a part of the script is this
while true ; do
echo
awk -v x=$(<"$TEMPDIR"size_container_in_byte) -v n=$(<"$TEMPDIR"parts) 'BEGIN{...
-7
votes
2
answers
93
views
How can I pick random items from a list, but some more often than others, in a Bash config file? [closed]
In Linux, using Bash, I have two scripts:
script.sh is the main script, and
script_config.sh is the configuration for script.sh.
In script.sh, I do source script_config.sh to load all the config ...
1
vote
1
answer
66
views
How can a bash script determine how it was started? [duplicate]
I am running various scripts on Debian 12.X currently with the following bash:
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
I have the following methods/options to execute the script.
...
0
votes
2
answers
91
views
Bash script, execute while command isnt outputting value
I'm trying to write a bash script (very new to writing them btw) on a Linux system, and I basically want it to execute a command every say 5 seconds while another command isn't outputting a value.
So ...
-3
votes
1
answer
50
views
Rename files, remove the first four signs [duplicate]
There are many files in this format:
IMG_20240717_191421.jpg
IMG_20240620_165358_BURST001_COVER.jpg
IMG_20240624_173513_2.jpg
how can they renamed in Linux in Bash to:
20240717_191421.jpg
...
0
votes
5
answers
128
views
Move/mark files and the associated-part too
There is a folder with many files in it:
112.mkv
123.md5
123.mkv
221.mkv
467.mkv
aa1.mkv
abc.md5
abc.mkv
bbc.mkv
dde.md5
dde.mkv
ggh.mkv
....
xxy.md5
xxy.mkv
xxz.mkv
How can I move .md5 files and the ...
-1
votes
2
answers
67
views
set output into variable from grep from input variable
whats wrong with this bash script:
acme2=$(dig txt @$1 _acme-challenge.$1.de)
acme3=$(echo $acme2 | grep "^_acme") ...
5
votes
4
answers
520
views
Getting multiple variables from the output of docker exec command in a bash script?
I would like to execute a script on a host machine (script_on_host.sh), which then reaches inside a docker container in order to grab some data using a second script (script_in_container.sh). The data ...
1
vote
1
answer
43
views
What is expr doing when processing arrays?
I have a BASH script problem that I've narrowed down but I can't understand what I'm seeing. I want to get a substring of an array in a succinct way. Here's what I'm seeing in bash, with 'set -x' so ...
2
votes
1
answer
167
views
select in a script
In Linux in Bash in a Script i use this:
#!/bin/bash
while true; do
while true; do
read -r -p 'enter number [4-999]: ' num
if [[ $num =~ ^([4-9]|[1-9][0-9]{1,2})$ ]]; then
...
0
votes
4
answers
90
views
Parsing data in Bash: adding commas after each string
I am attempting to generate a file that I can append to visudo. The task itself is not too important as I'm just trying to dig a little deeper Bash. My current script looks like this:
#!/bin/bash
...
-4
votes
2
answers
110
views
How to write in Linux in Bash in shellscript a part that can do something like this
How to write in Linux in Bash in shellscript a part that can do something like this
enter a number
must be in a range from 4-999
if not, ask again to enter
enterednumber * 5 * randomnumber [1-9] (...
0
votes
1
answer
46
views
question on bash efficiency (when/howto source a function and execute it)
I want to execute a this function on login as the postgres user
postgres@servcer:~/.bash.d/functions> cat check_pg-instances.func
#!/usr/bin/bash
# ################################################...
0
votes
2
answers
72
views
How to print the processed argument after each command invocation with xargs
i run this command:
ls -1 | xargs -I% -n1 -P8 myprogramm -s1 -r5 -q -o %.dat %
it works with 8 runs at one time, the -q switch in myprogramm for quit, that is ok so.
but i will add something like ...