Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

learn more… | top users | synonyms (1)

-1
votes
2answers
495 views

how do I install pdsh on centos 6? [closed]

I'm following a tutorial on how to configure a centos machine to be a node in a hadoop cluster for HortonWorks. I'm doing this on a virtual machine on VirtualBox. Sadly, since I am a linux beginner, ...
0
votes
0answers
21 views

Wrong PATH in init script on boot

Since the update of the System on my Synology NAS (x86) i have some problems with my startup scripts. The Bash scripts are stored in /usr/local/etc/rc.d. The scripts were executed for sure, because i ...
2
votes
1answer
124 views

Bash: two commands in dollar-parenthesis don't have same behavior

I don't undertsand why, in Bash: echo $(hostname --fqdn) works, echo $(id -un) doesn't (id: –un: No such user). Backticks give the same results. Is there some good practice for using this ...
0
votes
3answers
55 views

Add an additional check (bash script) to the sshd server

Is it possible to run an additional script during the login process of the sshd daemon/server? I would like to run an additional command that uses the IP address and the username of the attempt. If ...
1
vote
1answer
35 views

Bash script for updating multiple servers not accepting RSA keys

In my environment I manage about 10 Linux servers that require regular package updates. I have a script written to connect to each individually and run the update. Additionally, I have RSA keys ...
0
votes
1answer
31 views

Riverbed Stringray TrafficManger - API calls for Autoscaling

I am looking for advice on writing a bash script to put new server that we spin-up in AWS and get them added to our Stingrays. We are creating a new environment in AWS that will be muilt-AZ in AWS ...
0
votes
2answers
33 views

Why does this bash command sometimes return a blank string?

I have the following line to generate a random number: head -c 3 /dev/urandom | hexdump | sed -e 's/[0 a-z]//g' | head -c 1 This works fine but sometimes (very few) it returns a new line. Does ...
1
vote
1answer
45 views

Dovecot quota-warning.sh not being excecuted

I would like to run a custom script with dovecot once the user reaches certain percents of their quota. The issue is that no matter what I try dovecot does not seem to execute my bash script. ...
3
votes
2answers
586 views

stdout to gnu screen copy buffer

Is there a command in GNU Screen to direct standard output to the copy buffer I've been doing alot of work with files, it's great to copy and past the filenames I want into commands e.g. ls | grep ...
0
votes
1answer
30 views

Sourcing a config file in bash

I know I can source FILE or . FILE a file in Bash, but for some reason I cannot get it to load in the file. I keep seeing "No such file or directory" errors in the console. Here's the directory ...
1
vote
1answer
51 views

What is the Linux command to get the current PPTP ip address?

I have a Linux script that allows me to route some traffic through a VPN interface, and other traffic (from different IP) through another interface. This is my script: echo "ip route del default via ...
0
votes
1answer
40 views

Alias doesn't work in script with #!/usr/bin/env php

I've some PHP scripts which are starting with #!/usr/bin/env php. The default interpreter is PHP 4.4, but the scripts need PHP 5.3, so I created an alias in ~/.bashrc: alias ...
0
votes
3answers
1k views

git bash change username

I am using git bash and its trying to use my Windows username to login with "git push origin Dev" but I want it to use a different name, my username on the remote. How can I change this? Thanks
15
votes
5answers
4k views

Bash Loop - How to stop the loop when I press Control-C inside a command?

I am rsyncing a few directories. I have a bash terminal open and am executing something like this: for DIR in * ; do rsync -a $DIR example.com:somewhere/ ; done However if I want to stop the whole ...
1
vote
2answers
2k views

Running SQL*Plus with bash causes wrong encoding

I have a problem with running SQL*Plus in the bash. Here is my code #!/bin/bash #curl http://192.168.168.165:8080/api_test/xsql/f_exp_order_1016.xsql > script.sql wget -O script.sql ...
3
votes
3answers
172 views

Send bash -x output to logfile without interupting standard output

Is there a way to send the information displayed by running a bash script with the -x option to a file, while not changing the standard output seen by a user running the script? This is a debugging ...
0
votes
1answer
19 views

prepare domain list to work with squid 3.x

the latest version of squid do not accept duplicated domains like: example.com pre.example.com --- this is no longer necessary and it requires domains to start from "." adding dot is simple: ...
1
vote
1answer
56 views

Start Unix screen, Run command, Detach

How can screen be used to start a new session and run a command within that session without killing that session? screen -S myScreenName runSomething I tried the above command and it says [screen ...
0
votes
1answer
43 views

install mdadm without user input in wheezy

I am switching to debian from ubuntu and setting up RAID0 on my AWS boxes using user-data. Things were working fine on ubuntu but on wheezy apt-get -y install mdadm --no-install-recommends throws ...
1
vote
0answers
44 views

Ssh issues on Google Compute Engine

I've just updated a few servers to the newer version of the gce stack, and I've started having some ssh issues that I'm not quite sure how to fix. I've already looked into issues with the firewall, ...
0
votes
0answers
20 views

echo or copy file using distributed shell aka dsh

I'd like to copy a text file using distributed shell (aka dsh), but I'm having some trouble getting that done. I could just copy it like a normal file, but I don't want to because I'm trying to create ...
0
votes
2answers
57 views

Script for search string inside the file for every one hour

I need to write a script where the particular string(alphanumeric) should be searched inside the file with every hour for whole day. And the search should not contain the previous hour results. Time ...
1
vote
1answer
25 views

“s” character not working on command prompt after bash history completion

Im using Centos 6.3 and have customised my .bash_profile with the following commands to help with history completion (and colorising the prompt): bind '"\e[A": history-search-backward' bind '"\e[B": ...
2
votes
1answer
70 views

Terminate remote process when backgrounded ssh session is terminated

So right now I have a bash script that runs a command on a remote machine using ssh. The machine running the bash script is a Linux machine and the remote machine is a Windows machine running cygwin. ...
0
votes
1answer
48 views

Can a user be excluded from /etc/profile.d scripts?

I am having a problem using Rsync/SSH with a specific user for Amanda backups on a server. rsync -e 'ssh -i /var/lib/amanda/.ssh/id_rsa_amdump' -az otherserver:/dir/to/copy /copy/dir I have noticed ...
0
votes
1answer
39 views

How to find full process arguments and associated listening ports?

I can execute netstat -atulpn | grep java to find all Java processes with their accompanying ports, which is great, however I would like to also have the processes full execution arguments also shown. ...
3
votes
7answers
5k views

Escape a star (*) character in bash

I just cant do it. If * is in a variable, it expands to a list of files in current folder. echo "*" works fine. #!/bin/bash c="GRANT ALL ON \*.* TO '$1'@'localhost';" mysql < $c exit 0;
2
votes
1answer
62 views

BASH: alternatives to coproc [closed]

I have some scripts which use coproc to control stdout/stdin of subprocesses. Unfortunately, coproc was introduced in Bash 4.0, and on many systems I use, there is an earlier versions of bash. Are ...
2
votes
4answers
67 views

How to migrate ssh key to new CentOS server?

We have lots of scripts that run over ssh through saved (passwordless) key pairs. Both clients and servers are CentOS 6.x.I know that if you get a new client computer (where the scripts are run from), ...
2
votes
2answers
62 views

How to parallelize the for loop while scp the files?

I am running my below shell script from machineA which is copying the files machineB and machineC into machineA. If the files are not there in machineB, then it should be there in machineC. The below ...
0
votes
1answer
80 views

How to create ssl certificate for multiple domains which requires the CA root key in Linux

I have mail server. There are may domains hosted on it. I am deploying ssl certificate on it. I want that when user access there mail account using https browser should show that certificate is ...
-1
votes
3answers
38 views

How to create batch of specific number of lines in linux [closed]

I have a 10000 lines file.I want to create batches of 100 lines at a time in each different file.I know that this can be done using a while loop.But, I want to know whether it can be directly done ...
5
votes
2answers
4k views

No TTY present when running commands over SSH in here-document

I'm trying to run a command over SSH like this in a here-document: ssh example.com <<END sudo /etc/init.d/apache2 reload END Which normally works except when I'm trying to run something that ...
1
vote
2answers
44 views

My init script not showing up in service autocomplete

I made a init script for a ghost website. I'm using Linux Mint 16 (aka Ubuntu 13.10) When I type this, my script doesn't show up in autocomplete. sudo service f<tab> Any reason why? I get ...
1
vote
3answers
63 views

Completely reset PostgreSQL to default?

Question Is there a way to completely reset a PostgreSQL installation on Linux, so it is in the same state as when I installed it? Idea I have considered rm -rf /var/lib/pgsql/* rm -rf ...
16
votes
2answers
1k views

Is there a bash builtin for 'which'?

I've been testing a minimal Fedora install. To check the path for interpreters like python or node, I normally use which. I notice which isn't installed by default. I could add the package, but I ...
3
votes
3answers
2k views

Bash prompt on Ubuntu - FQDN (\H) same as hostname (\h)

We've got seperate environments at my workplace for development, testing, integration, and staging. Within those envs, we've overloaded the hostnames in DNS - e.g. in the dev environment, the primary ...
0
votes
1answer
32 views

Trouble with $PATH on debian

I think I have a problem with $PATH. I am running a shell script and it is complaining that it doesnt recognize the command even though when I run it manually it does. Shell Script: #!/bin/bash # ...
2
votes
1answer
97 views

init script terminating with ssh session

We need to run pt-stalk on a handful of servers to keep an eye on mySQL, and I was sick of manually starting it every time the server rebooted. A little googling turned up an init script for pt-stalk, ...
1
vote
2answers
94 views

permission denied in running script

I am running a script but there is an unusual warning: This is what happened in my console #whoami root #ls -l test.sh -rwxr-xr-x. 1 root root 1894 Feb 2 01:58 test.sh* #./test.sh -bash: ./test.sh: ...
0
votes
1answer
122 views

“Long service output” in Nagios gets chomped for some reason

According to this page the limit of $LONGSERVICEOUTPUT$ is 4kB, but in my case, it stops showing the rest of the output after 970 bytes of output (26 lines), where there multiple newlines no long ...
0
votes
2answers
45 views

How to remove all messages from exim mail queue from a certain user/email

I've spend the last hour trying to figure out how to delete all messages from a certain mail address from the exim mail queue, after the queue was full of spam emails.
1
vote
2answers
143 views

Linux Bash IF conditions not processing when running as crontab

So I've made myself a little script which monitors my served directories for any PHP files which have changed. It's designed to run every 5 mins from crontab and email me any changes so that I can ...
1
vote
2answers
42 views

Dynamically remove iptables policy by IP address

I would like to remove some NAT POSTROUTING rules in an automated fashion based on the source or destination IP address. I know the source and destination IP but I don't necessarily know which ...
0
votes
1answer
33 views

Bash: delete old files except one

I am using the following command to delete old backup files: find backups/ -name "bak_*.tbz" -mmin +4800 -exec rm -vf {} \; The problem: When there are no new files, than all files are deleted. I ...
0
votes
1answer
339 views

cygwin scp to linux box corrupts files, while winscp fixes the corruptions?

I have a bash script for deploying my app jars and sh files from the dev machine to prod machine (centos). it simply calls scp and copies all the necessary files. when I run it from an ubuntu box, ...
30
votes
8answers
9k views

bash: print stderr in red color

Is there a way to make bash display stderr messages in red color?
0
votes
2answers
27 views

Tinydns data file change ip with bash

I am using tinydns and need to dynamicly change some ip in data file. I want to use bash script for it. For example data file: +sub1.example.org:282.196.222.245:14400 ...
0
votes
0answers
18 views

Use tmux for managing multiple downloaders as a supervisorctl service?

I have many data-servers I need to download data from via http as soon as it is available. For each server I start a bash "while true"-loop and within that a wget to poll the server for new data. To ...
-1
votes
2answers
146 views

zcat/gzcat works in linux, not on osx. general linux/osx compatibility

First the specific problem: In linux, I use zcat to list a .zip file. In osx, zcat seems to automatically append .Z to the file name. Various people suggest replacing zcat with gzcat; however, gzcat ...