93,024 questions
0
votes
0
answers
89
views
keyboard backlight script not working well [closed]
Environment: Ubuntu 24
I'm trying to create a bash script to turn on/off the backlight after a period of time keyboard if no key is pressed.
It's working when I run it by hand, but when I try to run ...
2
votes
1
answer
74
views
Is there a functional difference between piping a variable with printf vs using parameter expansion in a heredoc?
Is there a functional difference when piping a shell variable with printf or using a heredoc and expanding the variable inside the heredoc?
Piping:
txt=…
printf '%s\n' "$txt" | xxd
Heredoc:
...
1
vote
1
answer
46
views
GIT command is not returning any value in makefile
I have a simple makefile that should print the Git log, which looks as below.
SHELL=/bin/bash
get_log:
echo $(git log)
3
votes
3
answers
140
views
Reading desktop notifications from the command line. Debian/Ubuntu
Running Ubuntu 24.04lts.
NOTE: I am trying to read the notification sent by he Discord app to my personal desktop notifications. When I notification from a specific sender, with a specific message, I ...
Advice
0
votes
1
replies
41
views
Analyze a directory in a performant (cross-platform) way for what file types (file extensions) it (recursively) contains?
Aim
My aim is to analyze a (big) (sub)directory and just find out what file extensions all files have there (recursively).
Additionally, these conditions apply:
I am on Windows, but I could use WSL ...
Best practices
3
votes
2
replies
95
views
How to efficiently bulk download from the internet archive
I want do download certain search results from the internet archive. I would like that the names of the resulted files and directories to be the title of the work -- idealy YYYY_<author>_<...
2
votes
1
answer
175
views
How to do nothing with "for in" in Bash? [closed]
for in in Bash is setting variable. I need only the variable itself from this command.
for VAR in FILE*; do
something (hate it)
done
I plan to use this variable later, not in the block itself. Just ...
1
vote
0
answers
71
views
Disable touchpad script fails while copied output works
I downloaded Fedora 43 Cosmic (Wayland) and found no way to disable my touchpad (mouse is always connected). xinput and synclient seem to be X11 only. Touchpad Disable is a simple checkbox with KDE ...
Tooling
0
votes
7
replies
133
views
One liner to get distinct values of all columns of a tsv
I am looking for a one liner that could be run in a linux terminal that does the below.
Takes as input a tab separated file (tsv) with many columns (~100) and creates a two column tsv output with ...
2
votes
4
answers
140
views
Is it the tty, the shell, or both that is responsible for echo-ing user input?
I seem to be observing conflicting evidence regarding how the tty and the shell share responsibility for displaying user input.
In the following interactive session, user input is no longer echoed to ...
1
vote
1
answer
82
views
How do I feed standard input to an Expect script to spawns a shell and collect standard output?
Consider the following Expect and Bash scripts:
spawn-bash.exp
#!/usr/bin/env expect
spawn bash
stty raw -echo
log_user 0
remove_nulls 0
expect {
-i $spawn_id "?" {
send_user -- [...
3
votes
1
answer
82
views
How to grep multiple words from a remote file in a SSH command to a target server
I wanted to execute the below command. I have a file with server names.
for i in \`cat /tmp/srv_list\`; do ssh $i "uname -a; uptime; grep -E "warn|error|failed|issues" /var/log/...
5
votes
3
answers
155
views
How to get the actual $0 as typed by the user in Bash?
When executing a Bash script from PATH, the $0 is set to some string that is equal to the full path of the executable.
Consider a script in /tmp/script.sh
#!/bin/bash
echo "0=$0"
echo "...
3
votes
3
answers
188
views
git config alias function : Bad substitution
I have the following git alias function that moves files into a directory using git mv of those files and then does the git commit :
[alias]
mv-into-dir = "!mvIntoDIR() { \
cd ${GIT_PREFIX:-.}; \
...
1
vote
1
answer
60
views
Copy stderr of previous command without rerunning it
(I am using the kitty terminal emulator, though I would appreciate answers for other terminal emulators as well.)
I run a command, and get some error message, like this:
~ » somecommand
❌️ Some Error ...