Bash is the shell from the GNU project. It is the standard shell on many Linux distributions and often available on other *NIXes.
6
votes
1answer
242 views
redirect and log script output
I am trying to tidy up the following snippets, design goals are to log all output from a script, and should not be a wrapper. Less lines are better.
I don't care about user inputs (at this stage), ...
6
votes
1answer
451 views
How can I change screen's hardstatus color based on the logged in user?
I haven't edited/created a .screenrc file in a while, but this is what I'm currently using:
# Turn off the screen startup message
startup_message off
# Define format of bottom ...
4
votes
1answer
226 views
Running parallel bash jobs on a HPC cluster using GNU parallel
On an HPC cluster I am trying to run multiple bash scripts (permute2.sh) from 1 bash script using GNU parallel, however it doesn't complete every job. It randomly completes one job, while it is stuck ...
4
votes
1answer
162 views
Need help on this bash auto completion script
I'm trying to setup autocompletion for a command, which takes only one parameter, a folder name,
In /secure/kernel_builds/, I have the three following subfolder:
3.5.6/ 3.6.2/ source/
Now I want ...
3
votes
1answer
60 views
How can I background a shell script during a Kickstart?
I have a Red Hat Kickstart process which reports its progress at key points via a POST request to a status server.
This is fine during %pre and %post, but when the actual build is taking place ...
3
votes
1answer
219 views
Confused about Debian error message from su
On Raspbian, the Debian distro aimed at RPi, I end up getting the following error:
$ sudo su -l root -c /bin/bash
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no ...
3
votes
1answer
301 views
Escape sequences in output of script called from ncurses application
I'm currently running mcabber as my Jabber client (which uses ncurses) in a tmux session on my homeserver. Locally i run iTerm2 as a terminal emulator, which supports the triggering of growl ...
2
votes
1answer
40 views
How can I fix this SSH hostname tab completion script?
I found the following script (for bash) that enables me to get tab completion for any hostname I've connected to (from ~/.ssh/known_hosts):
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ...
2
votes
1answer
102 views
How to debug and fix slow autocomplete in bash?
After a recent update (Ubuntu 12.04 LTS), TAB complete on the command line is slow. After entering a partial command (e.g evi [TAB]) or partial filename (e.g. evince somedocu[TAB]) the shell, ...
2
votes
1answer
125 views
Trouble w/ bash programmable completion of filenames matching patterns
I've got a simple command named th. I've got a bash-completion file for it that goes as follows:
_th() {
COMPREPLY=()
local curr=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -f -X ...
2
votes
1answer
235 views
Debugging hanging bash process
After some bad performance today, I checked top:
1 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14229 myuser 20 0 8776 5264 1684 R 99 0.2 1383:47 bash
98-100% ...
5
votes
0answers
182 views
How to merge multiple WebDAV accounts for backup?
I use davfs, aufs, rsync:
sudo mount -t davfs -o uid=wd,gid=wd,dir_mode=777,rw https://wd1.wd.wd/ /mnt/webdav1
sudo mount -t davfs -o uid=wd,gid=wd,dir_mode=777,rw https://wd1.wd.wd/ /mnt/webdav2
...
3
votes
0answers
73 views
Move files and delete directories with rsync?
Recently I needed to delete a large number of files (over 1 million) and I read that doing:
rsync -av --delete `mktemp -d`/ ~/source && rmdir ~/source
Was one of the most optimized ways to ...
3
votes
0answers
69 views
Auto completion for inaccessible directories
I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a ...
2
votes
0answers
24 views
LXC apparmor profile limits executing scripts in /run/*
LXC is blocking a trusted container from running scripts in /run/*, how do I configure LXC to allow scripts to run here?
2
votes
0answers
76 views
Log from TCP Port breaking messages on characters other than newline
I'm working on a set of scripts to monitor some external services that log to a TCP port.
function handleMessage {
while read message
do
# Handle $message
done
}
nc -d $ipadd $port | ...
2
votes
0answers
37 views
How to determine the current Enhanced Zoom factor in Compiz?
When I use Skype :( need to, rather than want to ), I find that I sometimes want to open the main menu, but it doesn't have a shortcut key assigned to it (well, not one that I can find).
I have ...
2
votes
0answers
242 views
How to enable local ~ autocompletion for scp?
Whenever I want to copy a file from my home directory, I run into the same issue: scp (using openssh-client 1:5.9p1-5ubuntu1, GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)) won't ...
2
votes
0answers
158 views
A problem with mknod when logged in as root
I am trying to load a char device driver written by myself. To achieve this I use a modified bash script published on this site: http://www.makelinux.net/ldd3/chp-3-sect-2. Here is my version of the ...
2
votes
0answers
206 views
KSH styling text based menu using STDERR
Is it possible to format the STDERR in order to have a better looking menu using the select command?
I have a simple select
select oChoice in $(<tempMenu.menu) ; do
case "$oChoice" in
...
2
votes
0answers
139 views
What is and how to use PS1 \#
I put this is .bashrc
# colors
NC="$(tput sgr0)"
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
# etc ...
PS1="\[$BROWN\]\u \[$CYAN\]#\# \[$PINK_BLD\]!\!\[$NC\] \[$BLUE\]\W: \[$NC\]"
So
deepo #50 ...
2
votes
0answers
220 views
Populate PS1 asynchronously
I have a few git svn related functions that see if I have to pull/push from/to the repository.
My problem is that the functions I've wrote to gather these informations are too slow, I'd like to make ...
1
vote
0answers
13 views
AWS XML response error signature does not match
I have a bash script that should return the XML response for AWS EC2 regions
but I am getting an XML error response as:
"SignatureDoesNotMatch" The request signature we calculated does not match the ...
1
vote
0answers
61 views
variable name lost when tab completing to export an environment variable with a path
I'm trying to setup an environment variable using tab completion, e.g.
snowch$ export JAVA_HOME=/usr/lib/jvm/java-6-oracle/
I used to be able to tab complete the folders after typing the export ...
1
vote
0answers
26 views
Modify .inputrc to fix Mac Terminal bug with vi mode
I currently have a bug in my Mac's Terminal (I actually use iTerm2 but it's still there), where once I press left arrow after typing, I can't go past the last character.
Is there a way I can modify ...
1
vote
0answers
25 views
Themed Tabs in Gnome Terminal
I've created a custom desktop session which upon login presents the user with a full screen gnome-terminal session. The idea is to have a TTY-like session but with the added advantages provided by X ...
1
vote
0answers
156 views
Create adhoc network when disconnected from network
I am using ArchLinux and want to create an AdHoc network automatically when the connection to the home network drops (or the home network can't be connected to on startup). How can I achieve this?
I ...
1
vote
0answers
28 views
rsstail Not Printing Output
I've installed rsstail 1.8 on my linux box and everything seems to be going smoothly, knock on wood, except for the part where rsstail isn't printing the streams. Running the command, I see that it's ...
1
vote
0answers
122 views
Using sshpass, return code (exit status) differs for reasons unknown using valid commands
There are a few things going on here but I think ultimately, either CLish or SSH is returning an exit code that is messing up my work flow.
I'm attempting to connect to a remote machine (CLish shell) ...
1
vote
0answers
146 views
Processing shell script options with awk
I'm looking for way to process shell script arguments that is cleaner and more "self documenting" than getopt/getopts.
It would need to provide...
Full support of long options with or without a ...
1
vote
0answers
180 views
Sending Emails from bash script in Solaris VM
I am trying to send emails using the following bash script:
/bin/mail -s "#subject" "$emailto" < "$message"
It works fine on my local machine but does not work on my VM.
I looked it up and read ...
1
vote
0answers
141 views
Conky - string formatting
I have conky the record:
${color lightblue} Down: ${downspeed wlan0} Up: ${upspeed wlan0}
Conky prints link speed, but the text moves:
Down: OB Up: OB
Down: 60B Up: 60B
Down: 148B Up: 148B
...
1
vote
0answers
36 views
mapping Character keys
I really dont understand bash`s use of control characters. I understand simple things like adding colors with escape sequences but am at a loss for how to do things like bind keys in .inputrc
For ...
1
vote
0answers
148 views
Why does this pipeline get SIGTTIN?
When I run the command for i in *.log; do cat "$i" | sort; done | more, the pipeline gets a SIGTTIN signal and is stopped.
bash$ for i in *.log; do cat "$i" | sort; done | more
### (one screenful of ...
1
vote
0answers
107 views
Display 'PRI' and 'NI' via 'top -stats'
I'm trying to create a script that prints top stat for some specific fields (e.g. pid, command, priority, nice value). I can print most of them by using -stats option, but there is no arg for ni and ...
1
vote
0answers
204 views
How to use history commands with readonly PROMPT_COMMAND?
I'm sometimes logged in on a host which I do not control and where PROMPT_COMMAND is readonly. Is there some way to work around this to run history commands anyway, for example using PS1? I've tried ...
1
vote
0answers
191 views
What happens when you background a function which calls another function?
Question says it all on the tin. Can someone explain to me what goes on here ? I'm trying to find out how to background a process in a script that calls another function and reliably terminate it when ...
0
votes
0answers
31 views
Easy way to push data into MongoDB from Bash shell script?
I know you can create a Javascript file that the MongoDB shell will execute upon startup. But I'm hoping for something more "lightweight" than that. I am using a Linux program that has a scripting ...
0
votes
0answers
30 views
In Linux is there any tools or package which can do STUN TURN ICE NATs and firewalls break end-to-end connectivity
In Linux is there any way to do this NATs and firewalls break end-to-end connectivity with existing package or tools?
e.g: close source cant use it for free
...
0
votes
0answers
47 views
unexpected bash behaviour after console login (openSUSE)
I'm trying to install a Linux OS on the computer I use as a home server, because I liked "Raspbian" so much on my Raspberry Pi. I created a custom linux using openSUSE Studio, that's just text based ...
0
votes
0answers
31 views
keyserver timed out when trying to add a GPG public key
I am trying to add a public key for installing a program with CPG. But i am pretty new to this but every command i found gave me the same error:
gpg --keyserver keyserver.ubuntu.com --recv-keys ...
0
votes
0answers
33 views
How to mimic bash tab completion behavior on OS X when using Linux
I'm an OS X user who's used to ssh'ing into various Linux machines. Recently, I installed Ubuntu on one of our servers and have noticed very different tab completion behavior in bash. Among other ...
0
votes
0answers
100 views
nscd uses 100% cpu
I'm working on a linux box and the output of top reveals that the command nscd (user nscd) is using 100% of CPU.
I'm uploading a flat file to MySQL from this box, and it is taking a long time (albeit ...
0
votes
0answers
108 views
Partitioning for Citrix Xenserver 6.1
How should look the partitioning of a 1TB hard drive for a dedicated server running Citrix Xenserver 6.1 ?
mount: / ext4 ?size?
swap swap ?size?
0
votes
0answers
42 views
Forking two interactive bash processes causes parent process to stop or second bash to go background
If you fork (exec) two interactive bash processes within same parent process (from different threads) causes that parent process becomes stopped or second interactive bash goes to background which ...
0
votes
0answers
106 views
DocumentRoot Sniffing in BASH
I have a quick question about Apache DocumentRoot sniffing using a BASH script. I have created a script that seems to work fine on my Ubuntu system. I have loosely tested the file on OS X and that ...
0
votes
0answers
91 views
flar archive creation
I'm facing issue, I need to perform a patch of a solaris flar image and all the commands take quite some time to perform it. To avoid me being in front of it I prepared a script that almost works ...
0
votes
0answers
117 views
Trap signals by an external shell on bash?
I tried to do this script:
#!/bin/bash
trap "echo trapped!" SIGUSR2
sleep 3s
kill -SIGUSR2 $$;
exit 0
and it works because it kills itself "from the inner".
if i try this
#!/bin/bash
trap "echo ...
0
votes
0answers
787 views
bad magic number
I have a script which I need to execute. The script file is push.sh. Below are the commands that I am using:
dragan@dragan-Lenovo-G570:~/liquibase/liquibase$ chmod +x push.sh
...
-2
votes
0answers
51 views
Copy directory onto multiple servers using a bash script
I have a local directory I need to deploy to 300 servers. What's the easiest way to write a shell script that mass-copies it to all of them?

