Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [bash]

BASH is the GNU Bourne Again SHell, the successor to the classic Unix Bourne sh (shell). It's the default shell for various GNU systems.

Filter by
Sorted by
Tagged with
2 votes
0 answers
22 views

I made this executable because I used to play on a MUD, which was essentially a server to which you connect to through telnet to play in a multiplayer world. What annoyed me was how difficult it was ...
Chip01's user avatar
  • 115
-1 votes
0 answers
48 views

I am designing Bash functions that take a timeout argument. The question is, what would be the best way to notify the user that the operation has timeouted, as compared to normal or error condition. ...
KamilCuk's user avatar
  • 109
0 votes
1 answer
185 views

What I'm asking here is whether do you think the facts there is no type enforcing; there is no indentation enforcing consoles do not syntax highlight consoles do not emphasize multi-line input a-la ...
Scrooge McDuck's user avatar
6 votes
3 answers
821 views

In the below script I am using some arrays, and other Bash stuff, but I have made a minimal working example for you, where you cannot see those things. Anyway, I am interested in a review of the ...
Vlastimil Burián's user avatar
8 votes
2 answers
477 views

We’re enforcing Azure Entra authentication across all Linux VMs, so we’ll disable all local accounts via a custom script. The script will also create a single “break-glass” user with a randomly ...
Dev's user avatar
  • 81
8 votes
5 answers
448 views

I'm looking for a (possibly cryptographic strong) hash function in Bash with the following properties: The input is only a string with 4 lower-case characters: aaaa to zzzz The output should be a ...
Tobias Grothe's user avatar
8 votes
2 answers
301 views

On Arch Linux, there are 2 packages that provide the Rust toolchain: rust itself and rustup. When users try to install a package ...
404 Name Not Found's user avatar
3 votes
1 answer
243 views

If you have files with Cyrillic filenames (e.g. день) and pack them as a ZIP archive on Windows, and then unpack on Mac using the standard archive utility, the ...
jsx97's user avatar
  • 207
7 votes
3 answers
319 views

The code works, but I could use help testing it more comprehensively and double-checking that everything I'm doing makes sense, and that all the options can coexist with each other. I'm running into ...
Sinjai's user avatar
  • 317
5 votes
2 answers
152 views

I’ve been working on a bash script to clean up old Docker images while keeping the latest tag for each repository and skipping images currently in use. I’m sharing the script below and would ...
Ilgar's user avatar
  • 51
1 vote
2 answers
151 views

This is a script to start a screen lock in Ubuntu, with user customizable background image(s). The script will eventually be run on sleep by systemd, so by root. This made it complicated to let the ...
Gauthier's user avatar
  • 306
1 vote
1 answer
62 views

I'm trying to automate my Arch Linux installation using a bash script. The script would allow me to choose between installing Arch on a single SSD or using a combination of SSD (for root and home) and ...
DarKnightz's user avatar
3 votes
4 answers
173 views

The script runs fine, and it seems to be working correctly. I'm looking for some criticism of the structure of the code, errors, bad practices, beginner's pitfalls, and bad code in general. I'm ...
Kizouyummi's user avatar
8 votes
1 answer
723 views

I've written a Bash function that can ask a simple yes/no question. The "yes/no" prompt is translated to the user's language (the question must be localised by the caller). Input is ...
Toby Speight's user avatar
  • 88.4k
1 vote
0 answers
109 views

Marvelous Bash does not support built-in sufficient namespace features for functions or variables to specific file/module you would find in PHP or JavaScript. Conflicts in global scopes, which are ...
Serious Angel's user avatar
5 votes
2 answers
109 views

I would like to ask for a review of the following Bash script which cleans up and datestamps file names, with an optional feature to rename the file. The main use case is renaming files downloaded ...
Thure Dührsen's user avatar
2 votes
2 answers
81 views

The path is provided as an argument by a Makefile within an install target. The script verifies if the specified path is already included in the system's ...
Madagascar's user avatar
  • 10.1k
3 votes
1 answer
69 views

Objective: The script should pass each file present in the data directory to the read_file executable, and print its result and ...
Madagascar's user avatar
  • 10.1k
2 votes
1 answer
105 views

I wrote this two-player tic-tac-toe program in bash. To make a move, you enter a number between 1 and 9 which corresponds to the square: ...
sbottingota's user avatar
  • 1,143
6 votes
1 answer
234 views

I wrote this two player tic-tac-toe program in bash. To make a move you enter a number between 0 and 8 which corresponds to the square: 0|1|2 3|4|5 6|7|8 This is ...
sbottingota's user avatar
  • 1,143
5 votes
2 answers
153 views

For a script, I came up with a shell function that might be generally useful. Before I add it to the code base, I’d like to hear someone’s opinion on this. I don’t write shell scripts often and had to ...
Bolpat's user avatar
  • 243
1 vote
3 answers
114 views

This is pretty horrible code, but it works. I don't code in bash 😭, usually code in Python. This is a learning exercise for me, so that's why I'm using bash + that's why I don't use libraries. I ...
M3RS's user avatar
  • 413
4 votes
1 answer
78 views

My deployment and configuration process entails multiple processes trying to invoke dpkg on my VM at the same time. While dpkg has a locking mechanism, it causes anyone not holding the lock who is ...
billp's user avatar
  • 43
1 vote
0 answers
74 views

Suppose that I want to subdivide a bash script into small idempotent functions, and I also want that those functions can depend on each other. For example, assume ...
Andrey Tyukin's user avatar
3 votes
1 answer
436 views

I'm a relative bash novice but have found it along with jq a great way to manipulate json scraped from various sources. I couldn't find any ready-made scripts to convert arbitrarily deep json to bash ...
joeblog's user avatar
  • 243
4 votes
1 answer
88 views

Part 1 Today's task involves extrapolating the next value in sequences, given in this format: 0 3 6 9 12 15 1 3 6 10 15 21 10 13 16 21 30 45 The task is to ...
janos's user avatar
  • 113k
3 votes
2 answers
67 views

Here's a script I wrote to automate testing for multiple sample files across two solutions, aiming to streamline the process. The script, provided below, compares expected results with the output of ...
Madagascar's user avatar
  • 10.1k
1 vote
0 answers
41 views

Part 1 In today's task, a network of paths is defined like this: LLR AAA = (BBB, BBB) BBB = (AAA, ZZZ) ZZZ = (ZZZ, ZZZ) The first line ...
janos's user avatar
  • 113k
2 votes
0 answers
92 views

Part 1 Today's task is to rank hands in a Camel Cards game and compute the total score. In Camel Cards, you get a list of hands, and your goal is to order them based on the strength of each hand. A ...
janos's user avatar
  • 113k
2 votes
0 answers
54 views

Part 1 To paraphrase the puzzle, given the times and record distances of boat races like this: Time: 7 15 30 Distance: 9 40 200 That is, the first ...
janos's user avatar
  • 113k
3 votes
2 answers
82 views

I have several Spring Boot and Angular applications/microservices that form together a whole application. As it is tedious to start them via the terminal, I've written the following script to perform ...
jmizv's user avatar
  • 135
5 votes
2 answers
1k views

Yesterday I thought was the last day of Advent Of Code 2023 that I do in Bash. I was wrong. I'm not even sure anymore that today will be the one. We'll just have to see tomorrow! Part 1 To paraphrase ...
janos's user avatar
  • 113k
1 vote
0 answers
128 views

Yes I'll keep doing this until I cannot be bothered to do it in Bash ;-) (Well today is probably the last one ;-)) Part 1 To paraphrase the puzzle, given some input ("engine schematic") like ...
janos's user avatar
  • 113k
6 votes
2 answers
2k views

To paraphrase the puzzle, Santa takes a walk with an Elf, and they play a game involving a bag of colorful cubes. In each game, there is an unknown number of each colored cubes in the bag, and the Elf ...
janos's user avatar
  • 113k
5 votes
1 answer
235 views

It's that time of the year again! Although there's no more Winter Bash, we can still have all the Bash we want in winter ;-) Part 1 To paraphrase the description: For each line in the input: Find ...
janos's user avatar
  • 113k
3 votes
1 answer
167 views

Parts C++ Mock Library: Part 1 C++ Mock Library: Part 2 C++ Mock Library: Part 3 C++ Mock Library: Part 4 C++ Mock Library: Part 5 C++ Mock Library: Part 6 Removing redundant MOCK_SYS usage After ...
Loki Astari's user avatar
  • 97.7k
3 votes
1 answer
125 views

VSCode's portable mode doesn't support auto-updates, unlike its normal installer-based versions. I happen to use MSYS2's UCRT64 environment which makes the Linux tools I like play nice with the ...
404 Name Not Found's user avatar
5 votes
1 answer
108 views

The following function searches for disks whose partitions all have an attribute that match a filter when listed with lsblk. Comments are in TomDoc format. ...
mikeLundquist's user avatar
3 votes
1 answer
101 views

The following function filters and formats /etc/fstab for future use. Comments are in TomDoc format. ...
mikeLundquist's user avatar
5 votes
1 answer
165 views

Overview I have created a bash script (triggered via GitHub Actions) that does the following: Parse a list of YouTube channel IDs and nicknames. Fetch their metadata via YouTube's Channel API. Build ...
Jake Lee's user avatar
  • 153
1 vote
1 answer
52 views

I have a directory structure like bellow. ...
Ahmad Ismail's user avatar
3 votes
1 answer
105 views

I asked a question yesterday (Protein databank file chain, segment and residue number modifier) and received a very informative answer by J_H whose feedback I have taken onboard. Some of the feedback ...
piJT's user avatar
  • 74
4 votes
1 answer
180 views

My first non-trivial bash script after fully moving to Linux Mint last week is attached (modify_cccp_bundles.in). The script ...
piJT's user avatar
  • 74
2 votes
2 answers
102 views

I am inputting a file of uniq -c | sort -nr and I need to take the string from the file, generate a unique id of the string and then Output a pipe separated value ...
Christian Bongiorno's user avatar
4 votes
2 answers
243 views

I have a handful of files containing simple configuration in which I need to modify values. There are some useful constraints that simplify my implementation: The file consists of single lines of ...
Toby Speight's user avatar
  • 88.4k
5 votes
1 answer
190 views

This is an ongoing project that has undergone a major update to speed up list processing. Here is the homepage for anyone interested. It processes lists defined in ...
T145's user avatar
  • 3,159
2 votes
3 answers
100 views

I know this is basic, being a Bash beginner, I like to learn the level of checking and testing when calling commands like; cp, mkdir, wget,... in a Bash function, and returning a result for the ...
user avatar
1 vote
2 answers
159 views

With Kubuntu 22.04 ... Questions : What is a better way than using 2 cases? The 1st case, script Line 48 "case $x in" lets user choose to clear screen or not clear. The 2nd case, script ...
joseph22's user avatar
  • 159

1
2 3 4 5
17