Questions about bash only, as opposed to other Bourne/POSIX shells. For all Bourne/POSIX-style shells, use the /shell tag instead.

learn more… | top users | synonyms

5
votes
0answers
69 views

How to stop bash editing the history when I reuse and modify an entry?

Some instances of bash change the command history when you re-use and edit a previous command, others apparently don't. I've been searching and searching but can't find anything that says how to ...
4
votes
0answers
83 views

can we use something better than more for tab completion?

more is not as convenient as less. Is it possible to use something better than more for tab completion, when ls and then tab? Thanks.
4
votes
0answers
237 views

bash does not autocomplete my command when using sudo?

I'm using SaltStack. I would like to auto-complete the minion name when calling salt command. The following line has been added into ~/.bashrc: complete -o default -o nospace -W "$(sudo ls -1 ...
3
votes
0answers
54 views

Errtrace and local

I am using the following script: #!/bin/bash -Eu trap 'echo Hi' ERR exit_failure() { echo "Hello, World!" return 1 } sub_failure() { res=$(exit_failure) } sub_failure It results in the ...
3
votes
0answers
133 views

Securing a script a little more

I currently have the following script which works fine: #!/bin/sh user="$(zenity --entry --title="Username" --text="Username")" pass="$(zenity --password --title="Password" --text="Password")" ...
2
votes
0answers
22 views

Is there a /dev/pts alternative on Mac OSX?

I'm attempting to determine how many terminal windows are open, as described in this Q&A answer. However there doesn't seem to be a /dev/pts on Mac OSX. Is there an alternative to this?
2
votes
0answers
23 views

tmux ignores the configuration files

tmux ignores the configuration files: both /etc/tmux.conf and ~/.tmux.conf. Even I pass the path to the configuration file, using tmux -f path/to/tmux.conf it still doesn't load it. The configuration ...
2
votes
0answers
33 views

How to display a BASH X terminal and graphics in split view window?

I created a simple education tool using BASH script which runs in an X terminal. It displays a prompt, at which users can enter choices, as described in the Bash Guide for Beginners' Catching user ...
2
votes
0answers
16 views

Remove tar compress spool from cron email

I have a crontab job that call a simple script to backup a website: 15 0 1,10,20 * * /home/username/bin/backup_whatever This is the script: #!/bin/bash TODAY=$(date +"%Y%m%d") ...
2
votes
0answers
55 views

Programmatically get CPUs 'detailed' usage, like top/htop

htop has a great way to show CPU usage. It shows the activity (usage in %) of each cores, and each core gauge is divided into three parts : blue: low priority processes green: normal processes red: ...
2
votes
0answers
41 views

Assign both menu-complete and dynamic-complete-history to TAB

Is there a way for me to assign both menu-complete and dynamic-complete-history to Tab (or one to Tab and the other to Tab-Tab) in .inputrc? I'm thinking there might be a way to setup a function and ...
2
votes
0answers
48 views

Simulate Initial Login of user without using sudo

I'm writing a script to interface 2 third-party programs. (Datadog and AWS) The data mining script uses sudo -u to run my script. The script that I need to retrieve data from will segfault if ...
2
votes
0answers
86 views

Write the same file multiple times to one file using dd

I am trying to create large dummy files on a drive using dd. I am currently doing this: #!/bin/bash writeFile(){ #$1 - destination directory/filename, $2 - source filepath $3 - blocksize, $4 - ...
2
votes
0answers
57 views

Why do some processes pass on their cpu usage to another process when it ends?

I have wondered this for a while. For example, lets say process1 is a process that uses a lot of cpu power, like 90%. Its a video game. Then i have process2 which uses 10-12% cpu. Its a web browser. ...
2
votes
0answers
20 views

git report moved lines

I want to track the number of additions and deletions that exclude moved lines. So if a commit has 10 additions, 5 deletions, and 3 moved lines, then I have 7 additions, 2 deletions excluding moved ...
2
votes
0answers
69 views

How do I execute a program in Xfce and make it use another xfwm4 theme other than the default one?

I want to run a python script (the one in the answer to Python - how to make transparent window with gtk.Window but not with Gtk.) that displays a transparent window. I'm running it from a bash script ...
2
votes
0answers
83 views

Bash tab completion fails inside of command substitution

I've been using kill $(pidof ) to terminate programs for a while, and since last night, every time I try to use tab completion inside the $() it throws an error, bash: unexpected EOF while looking ...
2
votes
0answers
63 views

When gnu parallel exit,my program also fail

I use gnu parallel to run a bash function. The function just contains the bash script to restart my program. At first, the restart is ok, but when the gnu parallel script exits, my program also fails. ...
2
votes
0answers
686 views

Can I change uuid for network interface in ifcfg-eth* using uuidgen?

I'm creating a script which configuration the network interfaces. The script which generates /etc/udev/rules.d/70-persistent-net.rules and names interfaces to my preference. In CentOS 6.5, my ...
2
votes
0answers
109 views

Bash tabcomplete file names for environmental variable values

After I upgraded my Ubuntu from 12.04 to 14.04, bash would no longer let me tabcomplete file names when setting the value of an environmental variable, e.g. FILE=/home/_ _ is where I would press ...
2
votes
0answers
934 views

How to use rsync with GNU parallel?

I am using scp to copy the files in parallel using GNU parallel with my below shell script and it is working fine. I am not sure how can I use rsync in place of scp in my below shell script. I am ...
2
votes
0answers
94 views

“Debugging” with bashdb: why do I lose command echo after stepping into a simple script?

I heard about the bash debugger ( bashdb ) after reading a comment so I thought I should try it out and see if it can help me analyze bash scripts or more generally the execution of commands. There ...
2
votes
0answers
139 views

gnome “switch user” shortcut or command line

Is it possible to switch user of gnome desktop environment by single command or any shortcut key, in centos 6.0, or Can we create shortcut key? I found "fusa", but still unable to install it.
2
votes
0answers
65 views

Batch mv cronjob leaving some (not all) copies in source

I have a cronjob that runs every 5 minutes, looking for wavs and mp3s of the same name in a source directory and if it finds a corresponding pair, it moves both to a destination directory. The script ...
2
votes
0answers
203 views

tty blinking cursor not at insertion point

I have an Ubuntu 12.04 system where I, at reboot, login a root. This morning I did the things I had to and thought about running apt-get -y upgrade I started typing this but before pressing Enter I ...
2
votes
0answers
349 views

exit code of grep in trap where the script is launched by upstart service

Recently I encountered a problem in ubuntu upstart and trap in Bash shell. I use ubuntu 12.04. The upstart script(/etc/init/player.conf) is: start on (local-filesystems and runlevel [2345]) stop on ...
2
votes
0answers
1k views

Script stops command in it with exit 0

When I write a bash script similar to this on RHEL 6, if [ "$2" = "" ] ; then echo vip.start: ERROR: no NIC specified echo vip.start: Need IP and base interface name exit 1 fi case "$1" ...
2
votes
0answers
118 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 ...
2
votes
0answers
73 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
319 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
183 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
295 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 ...
2
votes
0answers
323 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
24 views

Expect works fine,but only in foreground why?

I use this script for update my repo slackware(generate asc,txt,etc) http://slackware.org.uk/people/alien/tools/gen_repos_files.sh I have "automated" it with my expect script #!/bin/sh set -e ...
1
vote
0answers
49 views

Bash script run file redirect the license and difent key press to a dialog graphic tool

i am trying to show the license from the ".run" script file in specific , the "TeamSpeak 3 Client" .run , file I am trying to make this with "zenity" , "mate-dialog(s)" and "kdialog" ok right now i ...
1
vote
0answers
36 views

Repeatedly execute bash command while there's no output from another process

I'm running fs_usage to detect access to an object on my filesystem. sudo fs_usage -w | grep -E 'object' I now want to run a touch command on that object every 5 seconds as long as there's no new ...
1
vote
0answers
24 views

Dynamic ~/.ssh/config

I'd like make my ~/.ssh/config file dynamically generated by a shell script (or anything else that prints to STDOUT). Is there a UNIX trick to make reading a file result in executing a command & ...
1
vote
0answers
24 views

redirecting output of running background job in bash

in bash I have some jobs running, in background. They are always producing random irrelevant error messages that pollute the terminal. I am not always so prompt to start them with the 2>&1 > ...
1
vote
0answers
13 views

Capturing data from a Fluke 1620a via Bash /dev/tcp file descriptor

I am currently trying to develop a script that will connect to a Fluke DewK 1620a Themo-Hygrometer and pull the current temperature and humidity readings from the device. While these devices have a ...
1
vote
0answers
38 views

How to force bash to start at index 0 with select output?

Well, even some less-experienced bash users would know meanwhile about the fact that bash arrays would always start with index 0. However, select will always do its own thing, as the following example ...
1
vote
0answers
38 views

Automating sshfs not working

I want to mount a remote directory and I want to automate this. So I write below script which not working properly. #!/usr/bin/expect -f spawn sshfs vedams@192.168.5.109:/home/user /mnt/remote expect ...
1
vote
0answers
90 views

Opening multiple tabs in gnome-terminal, having them automatically password-lessly ssh to servers and do so using alias from my bashrc file

I regularly have to ssh into four or so servers we run, at the same time. I have aliased these like. SERVER1=root@server1 alias sshserver1='ssh -t ${SERVER1} "bash -rcfile .my_bashrc"' # Above line ...
1
vote
0answers
27 views

OpenWRT missing OD (octal dump)

I have a bash function using od command. Now I'm trying to run in on OpenWRT and see that in has not od. Also can't find it using install from opkg, because I can't find it. Is there a possibility to ...
1
vote
0answers
79 views

CentOS - upstart script is created, but its never running at all

I have this following setup but its not working in my CentOS 6x (3.10.23-xxxx-std-ipv6-64 #1 SMP Tue Mar 18 14:48:24 CET 2014 x86_64 x86_64 x86_64 GNU/Linux) Step 1: vi /etc/init/a.conf description ...
1
vote
0answers
52 views

passing variable through cat EOF command with for loop

How do I get the script run with the sbatch command to run with the 23 individual run_prep_chem_$dd.sh (i.e. run_prep_chem_08.sh...run_prep_chem_30.sh)? I am thinking since its in this for loop that ...
1
vote
0answers
66 views

export -f in .bashrc after upgrade to bash 4.3.30 kills builtins?

I recently upgraded my bash (Mac OS X 10.6.8) from 3.2.48(1) to 4.3.30(1) via macports, and while the install seems to have gone smoothly, the two spots in my ~/.bashrc where I had export -f myfunc; ...
1
vote
0answers
37 views

How do I recursively apply default ACLs of a directory to its descendants?

If I have a directory with default ACL entries assigned to it, but some or all of its descendant files and sub-directories have access or default ACLs that do not agree with those defaults, how do I ...
1
vote
0answers
71 views

Maintain screen session when executing shell script on boot

Solved: I solved this problem by introducing a delay before executing the script: @reboot sleep 60; /root/start_server.sh On Ubuntu 14.04, I have a crontab entry set to run on reboot: @reboot ...
1
vote
0answers
55 views

tput command + how to locate dialog window on the top of the screen

Is it possible to use the tput command in order to place the dialog window on the top of the screen ? For example The following dialog command display the log is running by tail command dialog ...
1
vote
0answers
193 views

Cannot SSH after switching to Netgear router

I have Comcast Xfinity internet. When I was sent their Wifi router/Cable modem combo box, I was able to use SSH perfectly. However, since the Wifi from the box was weak, I decided to buy my own ...