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
1answer
29 views

Find out which ending is the most common in a language [on hold]

I would like to work out what the most useful TLDs are for domain hacking in English. Here is a list of public suffixes https://publicsuffix.org/list/public_suffix_list.dat which I'd like to check ...
-1
votes
1answer
20 views

Error when executing command

This was my input while trying to minimize my protein structure in AMBER. $sander -O -i Min.in -o Min.out -p prmtop -c inpcrd -r Min.rst and the output said -bash: -O: command not found This has ...
0
votes
1answer
19 views

nmcli requires password to connect to VPN when nm-applet is not running

When I run nmcli connection up id VPNNAME when nm-applet is not running it requires a password Warnung: Das Passwort für »vpn.secrets.Xauth password« ist nicht in »passwd-file« definiert. nmcli darf ...
0
votes
2answers
26 views

Running a bash script with sudo privilege

I have a bash script which install bunch of opensource libraries (example :- opencv,octave,ff-mpeg and SDL etc.,) and I need sudo privilege to access most of the file paths. As far as I know, by ...
0
votes
2answers
55 views

How can I change the text after the @-sign in my terminal?

How can I change the text after the @-sign? I don't know what it means. It says DESKTOP-HMEEP40.
2
votes
1answer
209 views

Wrong string concatenation using Bash Windows Subsystem

I'm having headaches to know why my script doesn't work as expected under windows subsystem linux. My version from the store : Debian GNU/Linux 9.6 (stretch) (I tried ubuntu too, with the same ...
0
votes
0answers
13 views

How to write shell script which authenticates with AD credentials? [on hold]

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
17 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
45 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
24 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
29 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
33 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
22 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
39 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
65 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
20 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
33 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 ...
0
votes
1answer
31 views

Bash script, get number of physical cores as number and iterate

I wrote a script that shows a number of physical cores of the machine. However, I would like the result to be a number, not a string. Here's the script: phycores=echo $sudoPW | cat /proc/cpuinfo | ...
0
votes
1answer
63 views

“no such file or directory” when converting videos to new folder structure

I am trying to copy a large archive of videos (sitting in subfolders) to a parallel folder structure while converting the videos from mov to mp4 (plus some other tweaks). This is the command: for f ...
1
vote
2answers
442 views

Start process in background at keybind (append `& disown` on Ctrl+Enter)

Let's say I want to open Chrome, Sublime Idea, etc. from the command line while maintaining the control of the terminal. Is there a way to append & disown to the command in Bash when you press ...
0
votes
0answers
22 views

Why does symlink to VLC break but but .bash_profile alias works?

problem I can execute VLC from the command line using a .bash_profile alias but not using a sym link. 📝 VLC is located at /Applications/VLC.app/Contents/MacOS/VLC on my machine sym link I tried ...
0
votes
0answers
32 views

-iname parameter in find doesn't works correctly in Cygwin

I have a Cygwin 2.893 x64 installation in a Windows Server 2016. If a run this command: find "$(pwd)" -type f -iname *.jpg the output show only the files with jpg extension (case SENSITIVE) when i ...
-1
votes
2answers
31 views

Bash Command Substitution doesn't work

This is the script: #!/bin/bash thedate=$(date) var='Current date is $thedate' echo $var The output is Current date is $thedate and I'd like to make it show the date,what did I do wrong? ...
0
votes
0answers
21 views

use $file variable as input to bash script

If I try to use a for loop on the above script (which I called exon.sh) to define $file I get empty output. If I use echo I can see each .xtx is read into $file. for file in path/to/*.txt ; do ...
1
vote
2answers
44 views

Changing directory in script doesn't change directory — why?

I've seen this answer since searching for this, but initially I wrote this script: for i in `seq 1 $1`; do cd ../; done; It doesn't change directory. Why is this, running as ./updir.sh 5
16
votes
7answers
3k views

How to compare parts of files by hash?

I have one successfully downloaded file and another failed download (only the first 100 MB of a large file) which I suspect is the same file. To verify this, I'd like to check their hashes, but ...
0
votes
0answers
7 views

.inputrc bindings sporadically not working

I have the following entries in my ~/.inputrc file: "\e[A": history-search-backward "\e[B": history-search-forward Normally, this works fine. For example, if I type 'ss' then press up or down, I can ...
5
votes
1answer
56 views

Why does du -b show a different result than stat?

I've recently ran into this problem: find /tmp/tmp33hn25wv -type f -exec stat --format='%s' {} + | awk '{s+=$1} END {print s}' 10420224 du -bs /tmp/tmp33hn25wv 12198004 /tmp/tmp33hn25wv Results ...
3
votes
5answers
628 views

Multiple sed commands in Bash

I have a a file usernames and passwords in JSON format that I want to convert to process. I have used sed in different commands to process it but what I would like to know is how to lump all three ...
-2
votes
3answers
65 views

Ls and input redirection

I'd like to redirect contents of a file to ls command input: ls -l < /home/john/1.txt where 1.txt content is just: /etc I expected ls to list the content of file defined in /home/jonh1.txt - ...
0
votes
1answer
41 views

Replace lines after a given number of matches on separate lines with AWK

Currently I'm using AWK to find and replace a portion of a string after the first three occurrences of a pattern. The string is formatted like this: func(tempID="39849235",count='12');, and there are ...
0
votes
0answers
19 views

Custom scripts per Tilix profile terminal (Tab)

Where to find documentation or how to set up custom scripts. Basically i want to save Profile with 9 terminals(tabs) and configure custom commands to run on every terminal when Profile are loaded. The ...
0
votes
2answers
32 views

How can I get quotes to show up when I'm using AWK to find and replace?

Currently I'm using AWK to find and replace a portion of the first three occurrences of a string. The string is formatted as such, and there are many of these strings in the file: func(tempID="...
0
votes
2answers
54 views

Opening a wsl shell from another windows application

I'm trying to configure Tower (git client) to launch a wsl bash shell. I've tried a whole bunch of things, but it seems this isn't intended. What I tried: command: c:\windows\system32\wsl.exe ...
0
votes
0answers
20 views

How to change permissions under Mingw or Cygwin?

My ~/.ssh/id_rsa is 644 when it should be, I believe, 600. The host is Windows 10 and I have both git-bash 2.17.0 and MobaXterm 10.5-3582. If I try to change group, git-bash will fail with $ chown :...
0
votes
1answer
21 views

Remove subdirectory from path and promote files to parent

I have a bunch of files which contain within their path, a duplicated folder (in the following examples bar). I would like to remove this directory and move any contents in contains into the parent. ...
0
votes
0answers
24 views

how to start tomcat with `script -c` command?

I want to start tomcat with the command: script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh" After running the command, the console show the message that tomcat has started successfully. ...
0
votes
0answers
34 views

How to run a command when any process starts?

I have an sh script to update my wallpaper which uses pscircle in order to display running processes. The script runs every five seconds to update the wallpaper, but I would like it so that the script ...
0
votes
1answer
67 views

How can I use a “here document” in the middle of a pipe?

I am wanting to generate some content using a heredoc as a template: passphrase=$(<passphrase) envsubst <<EOF apiVersion: v1 kind: Secret metadata: name: openshift-passphrase stringData: ...
0
votes
1answer
20 views

When I change working directory in a script and execute it, the working directory only changes to specified path while in the script

When I change working directory in a script and execute it, the working directory only changes to specified path while in the script. Here is my script: #!/bin/bash cd /media/hard/drive/partitionX/ ...
1
vote
1answer
36 views

How to handle a .js extension correctly in bash script?

I have the following bash script. while IFS= read -r filename; do [[ $(md5 path/to/"$filename-orig") = $(md5 path/to/"$filename") ]] || echo $filename differs; done < path/to/list-of-files-to-...
1
vote
0answers
25 views

Exporting an variable

I have one script that exports an variable and second which reads it: script1: var1=abc export var1 ./script2 script2: echo $var1 Of course the variable var1 is accessible from script2 (returns "...
1
vote
1answer
71 views

pbcopy/pbpaste not same behaviour as copy and paste Mac OS

Running the latest version of Mac OS Mojave. I do: pbcopy < dir/sw7.s pbpaste > dir/testpaste.mips.s that copies the contents of sw7.s to testpaste, and the file size is exactly the same. ...
0
votes
2answers
28 views

Extract .tar.gz files in different subdirectories

i have phenological data of different tree species, but they are saved by the bigger Treegroup. The output of find . -name *.tar.gzis: ./Tilia/PEP725_DE_129_070.tar.gz ./Tilia/PEP725_DE_129_071.tar....
2
votes
2answers
99 views

Find Missing Numbers

I have a big list of files with names (videos) I managed to write all file names in a text file. Now I have a text file with a lot of file names (one episode per line) Now I need something that can ...
0
votes
0answers
34 views

editing what .sh files do on install

I'm trying to install Anaconda on my laptop running the latest version of elementary os. I followed the steps on the official site. http://docs.anaconda.com/anaconda/install/linux/ However when I ...