92,924 questions
Tooling
0
votes
3
replies
58
views
Python `.split()` for Bash?
With Python it's gorgeously simple, my problem is instantly solved in one method:
text='''
dab
a
b
c
dab
e
f
g
dab
h
i
j
'''
print(text.split('dab'))
Nevertheless, doing everything in Bash is a ...
-5
votes
0
answers
79
views
Get \n into a file with echo on bash on any computer [duplicate]
When I run on macOS zsh:
echo "\nunqualified-search-registries = ["docker.io"]" >> registries.conf
The registries.conf gets 2 lines, as I wanted
unqualified-search-...
-3
votes
0
answers
57
views
Challenges implementing efficient redraw system in custom readline (GNU Readline-like behavior) [closed]
I'm working on a custom readline implementation and I'm currently stuck on the redraw logic. I want to achieve a rendering model similar to GNU Readline, with proper cursor management and efficient ...
Advice
0
votes
3
replies
82
views
What is the <> token in bash
I am doing a project where I must simulate a small shell, the tokens I need to recognize and interpret as bash are:
<
>
>>
<<
|
I have understood the use and purpose of each of them ...
Advice
0
votes
2
replies
72
views
Is a fish shell variable just a string separated with spaces?
The docs say that all variables are lists, and I thought that meant they had some special internal structure that was outside the scope of the shell interface. Like, how the , in the python list [1,2,...
0
votes
1
answer
111
views
In shell pipes, maintaing resilience against orphaned process and buggy applications
Further note: The inconsistencies have been identified as due to an interface change in the tool, less that breaks backward compatibility. Beginning with version 603, it is required to provide the ...
1
vote
1
answer
106
views
Permission denied when running executable with systemd [closed]
On my Raspberry Pi 5 (64 bit) I'm trying to run a command via a python script, using systemd to start it at boot. The chain goes like this:
ids.service in /etc/systemd/system/:
[Unit]
Description=IDs
...
1
vote
1
answer
105
views
tput command will fail when redirecting stderr to /dev/null inside a command substitution
Running tput cols inside a command substitution, while redirecting stderr always make it fallback to 80.
Unless I redirect it to a terminal device file
tput cols # Output: actual ...
2
votes
2
answers
177
views
Why does this function see only 2 values when I send an associative array and 3 values when I send a normal array?
This is my function
#!/usr/bin/env bash
function run_aws_ssm_delete_parameters() {
local -r enable_logging="$1"
local -n parameter_names="$2"
shift 2
local -a ...
3
votes
1
answer
131
views
How to properly quote associate array subscripts in Bash?
If I declare an associative array in Bash, and then want to reference an element using a subscript which is a variable whose value contains spaces, when and how should I quote the variable name I am ...
2
votes
0
answers
97
views
How to include feature of using arrows to navigate through previous commands [closed]
I am making a shell orchestrator in C which connects with other devices and controls connected systems using an IP address. I am having difficulty in adding the feature to use arrow keys to navigate ...
Advice
0
votes
9
replies
60
views
Most efficient way to determine if a file exists only with a given extension
I have a little problem to crack that turns out to be less trivial than I thought - even to formulate as a question for the title of this ticket, in fact!
Here's the background: I mount my iPhone via ...
3
votes
1
answer
113
views
Receive "Error reading input file" when running password decryption in BASH
When working on a BASH exercise that is about building a simple password and account manager, I am required to add the function that allows users to retrieve an encrypted password. Below are my codes:
...
4
votes
1
answer
85
views
time shell keyword not respecting value of TIMEFORMAT when set before command
According to the Bash manual,
The TIMEFORMAT variable may be used to specify the format of the time information.
For instance, if I set TIMEFORMAT to %R, then time should only print the elapsed time ...
1
vote
1
answer
125
views
chdir syscall doesnt change my current directory
I am trying to implement a small Shell in C, one of the builtins required by my school project is cd. To do it, I use chdir to get a grip on some basics directory movement.
I have read the man of cd ...