Skip to main content

All Questions

Tagged with
-2 votes
0 answers
27 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 ...
user447274's user avatar
0 votes
1 answer
37 views

Counting unique IP addresses per hour in existing log files

I am trying to determine the number of unique web visitors to my website each hour. The log files (access*.log) contain many lines looking similar to this. 192.168.211.85 - - [29/Sep/2024:10:17:02 -...
kojow7's user avatar
  • 309
12 votes
1 answer
2k views

Why does cd '' succeed in bash?

Maybe I'm missing it, but I don't find it documented that cd '' should succeed. Since there is no directory with the name '', it seems obvious that it should fail. For example, mydir= cd -- "$...
jrw32982's user avatar
  • 1,069
-3 votes
1 answer
96 views

bash -n is a not documented in manpages or info documents [closed]

Even though bash -n is a valid and widely used option, some manpages don't clearly document it in the bash options section, even though it is implemented. It's also not in the GNU Bash Reference ...
bit's user avatar
  • 1,166
0 votes
1 answer
83 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{...
user447274's user avatar
0 votes
1 answer
103 views

How to compare output of a program with a reference value in a shell script?

I have my own implementation of a Redis server which I'd like to test through a shell script. The general idea is to feed it with some commands through nc, and since nc prints the output of my program ...
ivanbgd's user avatar
  • 111
0 votes
2 answers
97 views

How to redirect output from a program that waits for input

Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables: #!/bin/zsh pamtester login $user authenticate <&...
Namal's user avatar
  • 101
-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 ...
user447274's user avatar
-1 votes
2 answers
82 views

How to analyse a number of different datasets with a script and save the output for each dataset in a different new directory?

I am interested in analysing 50 different datasets with a script and saving the output of each of the 50 analyses in 50 different corresponding directories. To avoid doing this manually, how could ...
Carlos Fernandes's user avatar
0 votes
2 answers
79 views

How to "catch" the output of a command? [duplicate]

I'm struggling with the vocabulary here, so I'll ask this way: On an embedded system (Raspberry Pi) I use, there is a command invoked as follows: $ pin-control poll 25 This command "polls"...
Seamus's user avatar
  • 3,727
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. ...
ReflectYourCharacter's user avatar
-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 ...
user447274's user avatar
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 ...
user447274's user avatar
0 votes
2 answers
24 views

create unique folder on startup with rpi cam

I have a pi cam on a pi zero that needs to run for the whole duration of being on. this pi camera module is being used in stratospheric launch and during our last one we were able to get videos back, ...
purfi's user avatar
  • 1
1 vote
2 answers
75 views

Multi level submenu, return to previous level and main menu as options

I am working on a multi-level menu and I want to implement the ability for sub menus and sub-sub menus to return to the previous menu or go directly back to the main menu. Please see below... [Menu] 1 ...
Angela Zhou's user avatar

15 30 50 per page
1
2 3 4 5
460