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

learn more… | top users | synonyms

0
votes
0answers
3 views

ESC key does not work for whiptail on CentOS / Fedora

I have a problem with one of my shell scripts. The script starts with #!/bin/bash. It is an installation script using whiptail. I really need the 'ESC' key for at least a whiptail box using the ...
0
votes
0answers
10 views

Bash not working any more?

I was trying to install home brew (I am new to the command line and was following some tutorials on how to get up and running with github). So I was following this Unofficial Update Method: Compile ...
0
votes
3answers
25 views

Loop inside EOF - UNIX SCRIPTING

I am writing a script to automatic start up of an application whenever we found error in logs. so #/bin/bash if [ grep -c 'error' logs -eq 0 ] ;then exit else start <<EOF ## start is a ...
0
votes
0answers
2 views

Multiboot AD Binding Script Trouble (Error 10001)

So let's preface this with what I'm trying to do: I'm using DeployStudio to deploy multi-boot Macs, such as OSX10 and OSX09. My workflow goes like this upon Netbooting into the deployment server ...
4
votes
2answers
212 views

Get curl to output non-2xx to stderr, but 2xxs to a file

I would like some curl command, possibly with some bash hackery, that: Outputs any 2xx responses to a file Outputs any non-2xx responses to stderr Exits with a nonzero status code when a non-2xx ...
-4
votes
0answers
7 views

find all webservers running http with no redirect to https

I'm trying to build a list of all servers that are running HTTP and not redirecting to HTTPS. Using the following nmap command to build the list: nmap -Pn -p80,8080 --open -oG webserver.txt ...
0
votes
1answer
16 views

Join some files in bash

I have a task. I have to join files A:B.dsv, B:D.dsv and N:A.dsv. Column are separated by ':'. And I have to join by relation N:D. And sort end file by D. A:B.dsv: R0X 7M3:48B56 L6R 5X3:08P68 E1W ...
0
votes
2answers
42 views

Why is SSH not invoking .bash_profile?

My understanding had been that .bash_profile would always be invoked via an SSH login. However I am not seeing the various settings enabled unless I do the following: ssh $host "source ...
-3
votes
0answers
20 views

Study bash and awk. Where I can know bash and awk? [on hold]

Do you know where I can study bash and awk? I would like to a lot of exercise and example. Issues: bash awk grep join sort etc.
0
votes
1answer
50 views

/bin/bash is gone?

I typed the following command, and now bash isn't working. $ sudo chmod a-x /bin/bash_old /bin/sh_old It just says: login: /bin/bash: No such file or directory.
1
vote
1answer
19 views

Partition directories into subdirectories based on directory name

Background: a client's website stores user profile photos and other attachments into a single flat folder /user/images/*user_id*. They recently hit the directory limit (echo */ | wc echoes 31998, file ...
32
votes
3answers
3k views

What does this strange symbol “:>” in bash mean

I found something in a script, but not belonging to the main script. There was :> in a line. Could you explain to me what it means? :> file while read A B C D E; do echo "$A;$B;$D;$E;$C" ...
0
votes
1answer
15 views

FFMPEG merge consists of only one a single video instead of all of them

I am trying to merge several mp4 videos together in a folder. However, when I run the following script, sometimes only 1 video is in the output. For example, if I have video1, video2, video3, and ...
1
vote
2answers
32 views

“read” works as expected in ZSH but behaves differently when using any other shell

I’ve written a short while-do cycle but I found it working strange with different shells. That's it: find "`pwd`" -type d | while read -r D; do ls ${D}; done When I start it using zsh, all goes ...
5
votes
1answer
63 views

Why does rsync read .bashrc and not .profile?

rsync is a non-interactive program that logs into other machines. It shouldn't need the init file for an interactive shell session, and it should absolutely need the init file for a login shell. Or so ...
-1
votes
1answer
23 views

using find and delete files/folder - with the exception of 1 folder - challenging

i want to use find and delete everything with the exception of one folder if found. e.g. [oracle@SJOAM test]$ ls -l total 4 -rw-r--r--. 1 oracle oinstall 0 Sep 2 02:05 a -rw-r--r--. 1 oracle ...
22
votes
4answers
13k views

Change Terminal Title in Mac OS X

How can I arbitrarily change the title of a Terminal window in Mac OS X? I have seen this question and this magicwrap thing, but think it's just a simple Mac OS X command.
0
votes
2answers
92 views

How to open git for windows shell inside a tab on ConsoleZ

I have used git bash 1.9.5 from https://git-scm.com/download/win on ConsoleZ as shell and have no problem on open him inside a tab. But, with the new Git for windows 2.4.5.1 RC4, it open always in a ...
5
votes
5answers
6k views

How to use Cmd's tab autocomplete effectively?

I've used the Bash shell on Linux for years and I'm very fast with it. By frequently appealing for autocomplete by hitting the tab key, I'm able to write long commands in few keystrokes. Recently at ...
0
votes
4answers
573 views

How do I close stdin in a shell script?

I have a misbehaving program that I need to call from my script. It exits as soon as it sees something on stdin. Is there a way to close stdin?
0
votes
2answers
37 views

Pass variable from awk to bash

How can I pass variable from awk to bash? I want to pass a lot of variable, so I don't use: x=$(awk '.....) I thing it's not usefull.
-2
votes
0answers
19 views

How to move files and folders via DOS command [duplicate]

Can anyone suggest how can I achieve the task below, via DOS command or Windows batch file? I want to move all files and folders from source folder to destination folder. e.g. C:\source\file1.txt ...
2
votes
1answer
730 views

environment using su - vs “ssh user@machine” as a user on lucid

I'm trying to debug a shell environment issue on a machine running lucid. Both root & user have /bin/bash as their shell in /etc/passwd When I use "sudo su - user", my PATH includes the following ...
0
votes
0answers
8 views

Cannot remap Control-<key> to another Control-<key> using .inputrc in bash + Terminal + OS X

I'm trying to remap Control-g to Control-c for use in bash in Terminal.app in OS X. This is because Control-g in Emacs is 'abort'/'cancel', and my ingrained muscle memory leads me to hit Control-g on ...
0
votes
0answers
9 views

How to enable arrow keys on vim used from msysgit bash

I just need a simple solution that will enable the arrow keys in the vim included with Git For Windows. I did found a solution to enable backspace. But no solution for the arrows problem. The arrows ...
16
votes
3answers
20k views

How to enter login information for a website from the linux command line

My internet connection is provided by the university. It is protected to a username/password combination. This means when I start up my computer, I have to start a web browser and open an arbitrary ...
8
votes
2answers
17k views

Bash not loading '.profile' in new session on Linux

I'm setting up a new Linux machine I got from our IT dept, and noticed .profile is not loaded when I start a new terminal session. The current shell is Bash, though I changed it from the default sh it ...
47
votes
6answers
13k views

Is there a shortcut to mkdir foo and immediately cd into it?

This is something I do frequently $ mkdir foo $ cd foo This works as a single command, but it's more keystrokes and saves no time. $ mkdir foo && cd foo Is there a shortcut for this? ...
0
votes
1answer
23 views

Bash script to create a folder structure

I'm trying to write a Bash script to automate a recurring task, namely the creation of a structure of folders, where some of them should be numbered (To be more specific, this is meant to archive some ...
1
vote
2answers
4k views

How to auto commit to my git repository using cron?

I look into a lot of answers about this subject, but something is wrong here, let me explain. I create this script, to make my cron cleaner :) #!/bin/bash cd ...
0
votes
1answer
22 views

Keyboard layout in Terminal of Red Hat Linux changes automatically

I have an unique problem in Terminal of Red Hat Linux WS 6.6. After some of period of period (Don't know exactly when..) keyboard layout (and not language) changes from German to English ONLY in ...
-1
votes
2answers
46 views

bash No space left on device

On VPS when I press tab under my user I get: bash: cannot create temp file for here-document: No space left on device but it works fine under root, what's happening?
0
votes
2answers
91 views

Log in using SSH without password

On my server, I've got openssh-server and a special account without password. I'm creating a shell script, that must be used without user input. For example $(ssh dummyUser@dummy.com) I need script ...
3
votes
6answers
5k views

Messed up keys in vim when running inside tmux

I have been playing with tmux and I'm loving it. However, there's an annoying issue when running vim inside it. Somehow the arrow keys get remapped, but only on certain times, like when firing up ...
1
vote
1answer
14 views

Upstart: What is the first tracked PID w/o expect, but with script AND exec?

I have some Upstart configs used to start some foreground and blocking processes to run in the background as some kind of "daemons", especially those processes do not fork in any case. What I want is ...
1
vote
0answers
30 views

Is it Possible to get list of commands i typed in dos prompt?

I would like to search my own CMD history. we could browse within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions? Is there a ...
1
vote
2answers
52 views

Kill all tasks with PID above a certain integer with bash

How may I fetch and kill all processes with a PID above e.g 1000? Using commands like ps -A and top is fine for viewing the list of processes, but how would one only get the PIDs? The logic of ...
0
votes
3answers
303 views

bash shell error: “no such file or directory”

I am trying to install Virtualenv wrapper on Ubuntu 14.04. But whenever I start a terminal, I get the error saying bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or ...
2
votes
3answers
5k views

How to get git bash back in Windows Explorer context menu

I've had git running on my machine for over a year. I have a folder in my C root called gitRepo, which contains all my various repos. For some reason, for one repo only, the git bash command is ...
0
votes
1answer
20 views

Execute command generated by a PHP script

I have PHP file which has logic based on which I run either bin/phpunit -c Application/app --testsuite $TESTSUITE or bin/phpunit -c Application/app --group group1 group2 when Im doing ...
0
votes
1answer
37 views

Script to monitor realtime CPU & Bandwidth usage in xen live migration

I need to write a script (bash or python or ??) to perform live migration of a VM in xen, and to simultaneously log and extract the CPU & bandwidth usage of the Domain-0 AND write the output into ...
-2
votes
1answer
37 views

bash: Loop over lines of a file

Here is my script: #! /bin/sh for line in $(cat list); do echo "[$line]: Getting my workers list.."; var=$line-"worker1"; echo "$var" >> "hostlistworkers.txt" ...
4
votes
4answers
6k views

Rsync print only files that would have been changed

Is there a way to get rsync to print the full filepaths to all files that are different without actually transferring any files? Alternatively, I need a way to diff the files across two trees (over ...
0
votes
1answer
27 views

Problems running nmap export to file in linux as a cron job / bash script

I have a very simple bash script that runs nmap and exports the results to an xml file, and the uses scp to upload the file to a server: #!/bin/sh nmap -sn -oX /home/scan.xml 192.168.20.1-255 wait ...
0
votes
1answer
12 views

Use disk-backed buffer between pipes

I'd like to pipe a command into a slower one, with a rather big (~200GB) buffer in between. Here is an example use-case: command1 | buffer -f file.buffer | command2 Is there a command to do that? ...
0
votes
1answer
32 views

Sort file by two column in the event of two the same value

I want to sort files by one column, but in the event of two the same value I want to sort these two by other column. How can I do it? My file: 1 2 3 1 3 2 1 4 3 2 4 1 2 1 3 3 1 ...
1
vote
0answers
15 views

how to make less pager respond to scroll wheel and not clear the screen

I know about answers like how-to-make-mouse-wheel-scroll-the-less-pager-using-bash-and-gnome-terminal, which is to remove the -X flag from the $LESS environment variable. But I would like to do both ...
1
vote
1answer
849 views

Postgresql query within a bash script

We are having an issue with a postgresql bash query. The output of the query from the bash script add's additional quotes around the date. Please can you help me fix it?! Script: #!/bin/sh ...
0
votes
1answer
15 views

Not able to set wallpaper after reboot through ~/.fehbg in .xinitrc in i3 on Arch Linux

I'm trying to set my wallpaper using an automated script in .xinitrc rather than having to set it after every reboot by myself. I've used feh to set the wallpaper. And then used the generated .fehbg ...
0
votes
1answer
26 views

Why awk printing wrong string into the output file?

I'm trying to read file with awk and write the output in a new file. Content file sample: DATE_Login|09:01:20.507|2015-08-13|TIME_Session|00:32:32|MX|w32 ...