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

learn more… | top users | synonyms

1
vote
1answer
39 views

Execute multiple commands over ssh without reconnecting

I'd like to execute multiple commands through ssh from the script on my local machine, but without the need to reconnect for each command. Normally, I'd go with something like: $ ssh [user]@[server] ...
7
votes
6answers
434 views

/usr/bin/env: php: No such file or directory

I want to use .sh script for deployment of my app. That script is on my home server (Ubuntu 15.10 Server), marked as executable. Access to this script is done through ssh, using this tutorial, I have ...
3
votes
2answers
747 views

Using sed within a vi buffer

In a long text file listing dups-23Mar16.listing I want to delete lines beginning, for example, with .local. Here are some lines in this file: ...
2
votes
1answer
67 views

Why did my root change to -bash-4.1?

My root@servername automatically changed to -bash-4.1@servername in one of the servers. I have the same .bashrc on both servers. Also when I do echo $PS1 I get the following, and it's the same on ...
2
votes
1answer
30 views

How to avoid terminal to scroll down to last message in bash?

I write a bash script that run some other commands in new terminal: #!/bin/bash # Sample script gnome-terminal --title="blah blah" -x bash -c ffmpeg -i udp://239.1.2.1:60001?fifo_size=50000000 ...
0
votes
0answers
81 views

In Debian XFCE 4.10, how do I change the default Terminal shell from dash to bash?

I have a Debian-based Linux system (Kali Linux) running on AWS with the XFCE desktop environment. When I click on the "Terminal" icon in the application selector at the bottom of the screen, the ...
0
votes
0answers
14 views

Automatic documentation of dotfiles/config files configuration options

Has there been any work done on the front of automatic config file documentation? For example it is a good practice to add a comment line above/next to your config option, such as (source links at ...
0
votes
1answer
36 views

Ctrl-enter for fish shell

I had tried to create some accept completion and execute right away combination in fish on pressing Ctrl+Enter. function fish_user_key_bindings bind \c\n accept-autosuggestion execute end ...
-1
votes
1answer
50 views

Search for string inside pdf with pdfgrep and outputs only file name

I'm using pdfgrep to search for a name inside a pdf: pdfgrep -H 'Fatima Alves' RE/* This commands will output the file name and the name: RE/2011-01-RE_60822079000168_23022016_153923(1).PDF: ...
1
vote
1answer
33 views

Rename files with counter over subdirectories

I have a parent directory with a number of directories in it. Within those I, again, have multiple subdirectories, they contain many images: Parent | ├──dirA | ├──sub_A1 | | ...
1
vote
1answer
34 views

How can I control my minecraft server when I run it at boot with a rc.local script?

I have a question your you guys. I'm running a MC server so far so great. In order to make it autonomous I run it at boot with a bash script load in rc.local, simple. #!/bin/bash cd /home/minecraft ...
2
votes
3answers
33 views

Using a wildcard in a condition to match the beginning of a string

Trying to have a variable meet a string of text that varies by length. The part of the string that matters is the first couple of characters. var1=hello if [ $var1 == hello ]; then echo ...
1
vote
2answers
14 views

If Statement not evaluating as expected. Am I setting up my variables incorrectly?

I am trying to create a command that will allow me to check websites for specific words. I used \ at the end of the line to wrap it to the next, (not sure if I used those correctly here) these ...
1
vote
1answer
26 views

How to use the “sed” command to remove all lines that do not end up on the pattern?

How to use the "sed" command to remove all lines that do not end up on the pattern? Example (.txt - pattern) aaa aaa.com b b b b.txt ccc ccc.gif dd dd dd.txt I want to get: b b b b.txt dd dd ...
-1
votes
1answer
44 views

How can you pass output of find command to a diff command with multiple files?

I find 5 files ending with .csv. Now I want to compare the content of these files using diff command. How can I perform both actions in one command on a Linux terminal on bash? I want to do something ...
2
votes
2answers
383 views

Zip all uncompressed file in a folder in one line

I have a lot of text files that I want to compress. Each file must be compressed separately. But some of them are already compressed. How do I, in one line, compress all files that end with .txt by ...
0
votes
1answer
25 views

Downloading multiple files in parallel with changed names

I'm writing bash script and don’t know how to solve my problem. I want to to download multiple files at the same time , but ... I want to save the files under modified names. I have a variable ...
1
vote
1answer
34 views

Replace multiple files recursively

I have a file structure like this: experiment/ ├── foo.txt ├── source-foo.txt └── subdir └── foo.txt I want to take the file source-foo.txt and replace the other foos with it. Just like doing ...
1
vote
1answer
16 views

Check hash and then do a certain function

I am trying to check a hash (doesn't matter which), and if a certain hash is met, then run certain commands. Currently my code is if [[ md5sum $file -ne $sum ]] then $commands fi However, ...
0
votes
1answer
643 views

Shell provision script not creating .bash_aliases

I'm using Vagrant with VirtualBox to create an Ubuntu guest VM, on a Windows 10 host. Here's my Vagrantfile: # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" ...
0
votes
2answers
13 views

How can I expand both a variable name and a wildcard in a file name?

I have a bash script where $DIR is a directory name that may contain spaces. This: rm "$DIR/*.MOV" gives the error "No such file or directory". There is no file literally named "*.MOV"; I want the ...
0
votes
2answers
98 views

How to POST file contents using cURL?

I want to do an HTTP POST of the contents (as a string) of a local file located at path/to/my-file.txt to a URL endpoint at http://example.com/. For example, I might want to do the following: ...
1
vote
1answer
131 views

Cannot move ./test to a subdirectory of itself, './test/test'

When trying to convert some files to lower case I noticed something which seems strange to me. When executing this in bash: find . -iname 'test' | while IFS='\n' read item; do mv $item $(echo $item ...
0
votes
2answers
81 views

script to ssh multiple servers with different password

I have a script that executes same commands on multiple servers via ssh . spawn ssh [lindex $argv 0] send "sudo /usr/sbin/useradd ytkatchen" expect "password:" send "Unix\@999\r" My password is not ...
0
votes
1answer
45 views

Unable to install rpm in a particular path (cpio: mkdir failed - No such file or directory)

My .rpm files like this.. $> rpm2cpio bq1510-15.10.01.06-1.i386.rpm | cpio -it ./opt ./opt/td ./opt/td/client ./opt/td/client/15.10 ./opt/td/client/15.10/bin ./opt/td/client/15.10/bin/bq ...
-2
votes
3answers
285 views

How can I write a bash function that checks if an integer is even or not?

How can I write a shell predicate function event that takes an integer argument and tests if it's even or not?
0
votes
1answer
52 views

Using windows Git Bash in MobaXterm

I have custom macros etc in my mobaxterm, but I have worked for a half a year on a remote linux machines, now I have my code on my local PC and I use git bash. Can I use it through MobaXterm?
1
vote
1answer
50 views

Redirect STDERR and STDOUT to file with timestamp on each line

On my CentOS I am trying to execute a php script that contains an endless loop to do some fancy stuff inside. It doesn't matter that an endless loop may not be an accurate solution for most cases, but ...
-1
votes
1answer
44 views

ls: show date of last updated file in directory tree, for each directory/file in list

I am looking for parameters to ls, or something equivalent, that do the following for a specified directory: For each subdirectory: Look at each file and directory it contains, recursively. Find ...
0
votes
1answer
25 views

OS-X download, “Add the following statements to your .profile file: ” EGSnrc download

I have nearly configured EGSnrc on my OS-X machine running el capitan The final step is the following.... The EGSnrc configuration for NAME is ALMOST complete ... EGSnrc requires various ...
1
vote
2answers
35 views

BASH script syntax check, track execution?

As a (Debian) Linux newbie I was wondering if there is a way to track the execution of a bash shell (.sh) script ? Like in Windows you trigger that with a echo on command in a batch file. My first ...
1
vote
0answers
41 views

Reproduce “no more processes” error

For academic purposes I would like to reproduce the error message "no more processes" on my bash terminal. For example: $cp file1.txp file2.txt bash: no more processes How can I do that?
0
votes
0answers
45 views

SSH Tunnel between devices behind firewall and vps ubuntu server

I am trying to establish an ssh tunnel between devices, that run OpenELEC and my ubuntu vps server. The idea is that the devices will open an ssh tunnel to the server and keep it on at any given ...
3
votes
0answers
114 views

Unable to rsync to another volume with Git Bash

I use git bash on a windows machine: version 2.7.2 (32-bit version) of Git for Windows built on 2016-02-23 available from https://git-scm.com. Within bash I can copy a directory from /c/ to /e/ (a ...
-1
votes
1answer
165 views

What is Git Bash for Windows anyway?

I have happily been using git and git bash from https://git-scm.com/. There is a page with more information here: https://git-for-windows.github.io/. Yesterday I ran into a problem with rsync and ...
0
votes
2answers
27 views

How to use wilcards on chown command?

I need to use wildcards on chown command. Example: # chown app:demo /opt/app/users/*/demo But does not work. What can I do?
0
votes
1answer
49 views

Bash loop for adding --exclude list to tar

I have a bash script I made to encrypt/decrypt using GPG and tar. Right now I have my --exclude hard coded into the script, but I'd like to make it a bit more dynamic and add the items to exclude as ...
1
vote
2answers
48 views

How to list directories and subdirectories with a directory as argument (Bash)

The task is to make a bash script in ubuntu. It's supposed to take a directory as an argument, and list all directories and subdirectories from that argument. I don't have much experience with bash, ...
1
vote
2answers
41 views

Grab a section from a large file between two known substrings using sed?

I have a pretty large XML file without line-breaks. It's so big it's slow to open and operate on in Emacs or other text editor. But I just want to extract a shortish section of it between two known ...
0
votes
0answers
27 views

elementary OS + Bash + VIM tab completion broken

When I type :q and press Tab, I get this output: :q^I Instead, it should complete it to: :quit My ~/.vimrc: " An example for a vimrc file. " " Maintainer: Bram Moolenaar <Bram@vim.org> ...
1
vote
2answers
24 views

Pass SIGINT through bash script to application

I have a Linux application, written in C++, which traps the SIGINT interrupt in order to do some final cleanup before exiting. I call this application within a bash script. Now, when I type control-C ...
0
votes
2answers
63 views

simple arithmetic operations on a tab-delimited text file in shell script

I have a tab-delimited text file containing C1...Cn columns and R1 to Rn rows. Column 10 (C10) has a field 'X'=four comma separated integer values (X=a,b,c,d). I would like do a small arithmetic ...
4
votes
1answer
50 views

Remove All Illegal Characters from All Filenames in a Given Folder and subfolders

I Know this was was basically answered and the automator with the shell script (Sanitize Filenames) works great, but I need it to also do all subfolders as well. And if possible trim the file name ...
-1
votes
2answers
38 views

what does “exec 5>>foobar.txt” do?

What does the shell command exec 5>>foobar.txt do? I can't google it for obvious reasons, and otherwise not sure where to start looking.
5
votes
1answer
22 views

Add date watermark to jpg images

I am attempting to add a watermark to images that contains the date. I am not having any trouble putting text on images but as soon as I try and put a date I get unpredicted results. convert ...
0
votes
2answers
62 views

using sed in BASH script: replace text with info from system variables (hostname and date)

I want to use a bash script to run a backup and then send me an email using ssmtp. I am trying to make a generic script that I can reuse across different Linux machines. Below is a snippet of the ...
1
vote
1answer
22 views

Reauthentication behavior of SCP with curly braces

I have the following files on a server: A_Hello.txt B_Hello.txt C_Hello.txt A_World.txt B_World.txt C_World.txt A_SU.txt B_SU.txt C_SU.txt A_IDONTWANTTHISFILE.txt If I try to download the desired ...
0
votes
1answer
168 views

Mac terminal error -bash: command not found - El Capitan 10.11.13

I'm getting an error message when I first open my Mac terminal - -bash: Applications: command not found Oddly (or maybe not so oddly), when I open another tab, I sometimes get a different error - ...
0
votes
1answer
15 views

Why sed regexp digit character class includes CR character if the last digit is at the end of the line?

I wanted to extract the Content-Length's size from an URL and output the URL + $size on the same line. The data I worked with: > curl -I -s http://yahoo.com HTTP/1.1 301 Redirect Date: Thu, 10 ...
0
votes
2answers
78 views

How to run the “cat” command on the background inside the script

I have a USB LTE modem connected to my Raspberry and I need to read replies sent via serial line, generated by requests sent using the "echo" command. Code: cat /dev/ttyUSB0 > ttyUSB0_logs & ...