Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bash]

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

0
votes
0answers
4 views

How to write shell script which authenticates with AD credentials?

I Have a scenario. There is a script of mine which will be used by a Team. I want to make sure that my Team members would run that script only after authenticating with their UNIX server access, ...
0
votes
0answers
15 views

Run commands with voice on Kali Linux

I use kali linux. I want my mic to listen all the time, and when I say a word, a command executes. I found this article about it HERE However, when I try the command: sudo add-apt-repository ppa:...
0
votes
1answer
29 views

ip does not work / does not produce output when run with cron

I have a bash script in which I use the ip r command. When I run the script in bash it works but when cron runs it it does not. This is the line in my script: ping -q -w 1 -c 1 `ip r | grep -m 1 ...
1
vote
1answer
15 views

inotifywait name space issue

I follow the "/ home" directory and its subdirectories with the bash script below. but when the directory names are blank, the script does not work correctly. #!/bin/bash inotifywait -m -r -e ...
0
votes
1answer
30 views

SED - complex text deletion and pattern matching

I searched allot on SED. I'm new to using it. Managed to make a command that deletes a block of text between PATTERN-1 and PATTERN-2 (including the patterns) in a large (250mb+) text file. Now I have ...
0
votes
0answers
26 views

zsh sometimes doesn't show stdout

When I have a command that generates a lot into stdout zsh recently (last 6 months AFAIR) stopped showing the output. e.g. when I do a: for i in `seq 2000`; do echo AAA; done I don't get any output,...
0
votes
1answer
31 views

How to get the result of command substitution without using stdio and stderr?

I have a user-provided bash script that creates a directory in some way and outputs its path. It can work in many ways, for example, it can clone a git repository, do some setting up, and then output ...
-1
votes
0answers
21 views

Window moving unpredictably with wmctrl

Trying to script up some wmctrl here, and I've run into some issues. Here's my script. #!/bin/bash moveX=$1 moveY=$2 sizeX=$3 sizeY=$4 if [ -z "$moveX" ] || [ -z "$moveY" ] || [ -z "$sizeX" ] || [ ...
0
votes
2answers
36 views

Store $(java -version) into a bash variable

Why when I do this: $ var=$(java -version) on my bash terminal, var is always empty? Same thing with $ java -version >> version.txt nothing is sent to the version.txt file.
0
votes
1answer
64 views

How to start bash subshell without environment but with .bashrc

I'd like a create a bash subshell that does not inherit any changes I've made to my environment. Basically I want my environment in the subshell to be how it was at login. I thought env -i bash ...
1
vote
1answer
24 views

Why does command substitution not work in braces but replacing it with the actual number works?

I'm using the following command to try to max out the number of cores on my server: for i in {1..`nproc --all`}; do while : ; do : ; done & done For some reason, it only ever uses one core, even ...
0
votes
1answer
19 views

Print all commands in a bash function

I am trying to debug a bash function. Is it possible to print all the commands executed by a bash function? I know that it is possible to print all the commands by a bash script by changing #!/bin/...
1
vote
0answers
32 views

Running a process in the background

I have 2 questions about starting the processes in the background: Why does starting a process in the background like so: ./my_program & (my_program have exe permission set of course) doesn't ...
2
votes
1answer
21 views

“__bp_preexec_invoke_exec: No such file or directory” when using $_

I am trying to create a new directory and simultaneously switch to it in one line command on Bash using mkdir repo && cd $_. This has worked well for me previously on all Linux distros but now ...
0
votes
2answers
36 views

Average of multiple numbers - Shell script

I have created a script which views a logfile and greps for a specific amount of milliseconds / seconds. I have created something which views the minimum and maximum value however I need to find the ...

15 30 50 per page