All Questions
743 questions
-1
votes
1
answer
83
views
Creating in Linux files in GB or MB range by various size by read a file [closed]
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 ...
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 ...
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
vote
1
answer
100
views
Open pdf files by terminal with fzf and fd
with the following command line, which I turned into an alias, I would like to open the pdf files from my terminal.
alias pdfLoad="fd . '$HOME/OneDrive/DBCalibre' -t f -e pdf | fzf | xargs -0 -...
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 ...
4
votes
2
answers
545
views
how to check if the path from where the script is started stored on a hdd or ssd drive?
how to check if the path from where the script is started stored on a hdd or ssd drive?
i have read that cat /sys/block/sda/queue/rotational show 0 for ssd and 1 for hdd.
if [ "$(</sys/block/...
1
vote
1
answer
110
views
add a randomize option in a bash script
in a bash script i do run this:
seq 1 $(<howmany.txt) | xargs -I% -n1 -P$(<parallel.txt) mycommand --infile file% --option A --outfile file%.new
it works.
the values in howmany.txt and parallel....
1
vote
1
answer
82
views
Is [..] posix compliant while [[..]] is not [duplicate]
I read somewhere that in a shell script the [..] construct like for example [ -e $HOME/temp ] is POSIX compliant. While the script [[..]] construct like [[ -e $HOME/temp ]] is not.
Is this true?
Apart ...
0
votes
1
answer
124
views
How to add some random data at certain places in a file
With my Computer, it runs a Linux kernel and bash, i will make a technical-experiment.
I have a file, file.dat, size = 1.048.576 byte.
I will add at certain places in file.dat some irregular (1...8 ...
0
votes
1
answer
121
views
Difference between -v, -z and -n while comparing variables in a shell script
There are the following ways to check if a variable is available or not in a linux/unix shell script
[ ! -z "${MYVARIABLE}" ]
OR
[ -n "${MYVARIABLE}" ]
OR
[[ ! -v MYVARIABLE ]]
...
1
vote
6
answers
668
views
Bash script that takes multiple path arguments and checks if files can be successfully created there
I would like a bash shell script (for my Debian 12 system) which accepts multiple paths as arguments, and then checks if a file can be successfully created in each one. Then the result should be put ...
0
votes
1
answer
36
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
60
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
70
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 ...