Questions specific to GNU’s Bourne Again SHell, as opposed to other Bourne/POSIX shells. For questions about Unix shells in general, use the /shell tag instead.

learn more… | top users | synonyms

4
votes
0answers
32 views

Bash completions -C vs -F

In the bash completion setup (https://github.com/scop/bash-completion) supplied by my system there seems to be an unequivocal preferences towards completing with complete -F as opposed to complete -C. ...
4
votes
0answers
85 views

bash process substitution with temporary file

Some programs needs their files to be seekable, for example objdump does. $ objdump -D -b binary -m i8086 <(echo 0xea 0x5b 0xe0 0x00 0xf0|xxd -r -p) objdump: Warning: '/proc/self/fd/11' is not an ...
4
votes
0answers
76 views

Highlight current bash prompt line

I want the terminal to highlight the current bash prompt line. The effect I'm trying to acheive is the same as in text editors where the current line with the cursor is highlighted. Something like ...
4
votes
0answers
673 views

Real GNOME Wayland session

I'm trying to test a "real" wayland gnome session. I know that not all applications can run on Wayland natively (for this we have XWayland) but at least I would like to have GTK+ applications to do ...
4
votes
0answers
144 views

Bash command not found due to stray garbage characters

What is the cause of this behavior? $ cd ../ $ bash: $'\210\210cd': command not found This happens sometimes (rarely) when I enter a command, there is no visible character preceding the cd, still ...
4
votes
0answers
214 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 ...
3
votes
0answers
45 views

Memoizing/caching command line output

I have a bash script I use to run a few python and C++ programs in a sequence. Each program takes in some input parameters which I define in the bash script. So as an example I run the program like ...
3
votes
0answers
21 views

How to resize images to fit all content on minimal canvas?

I'm trying to quickly check for differences between separate iterations of a web site using ImageMagick's compare. But it refuses to compare images of different size, and doesn't seem to have an ...
3
votes
0answers
36 views

What process state(s) is counted into cpu time?

Two observations of mine (correct me if wrong): In the output of time for timing a process, 'User' and 'Sys' come from wait (2) or times (2), depending on the particular system. In Linux ...
3
votes
0answers
70 views

How to get bash tab completion to work with read only file system?

I have deliberately configured the file system of my RaspberryPi (Raspbian - Jessie) to be read only. One of the things that's not (yet) working is tab (aka auto) completion in bash, where I often get ...
3
votes
0answers
68 views

Unable to type apostrophe in the terminal

I'm unable to type the character ' in urxvt. Nothing happens if I press the button to type it. If I copy something to the clipboard that contains ', and paste it with shift+insert, the text is ...
3
votes
0answers
73 views

Suspend a process silently with ctrl-z

With my current workflow, I frequently use CTRL-z to suspend Vim so I can enter a quick few commands before resuming editing my code with fg (actually, it's CTRL-z again, thanks to the handy ZSH tip ...
3
votes
0answers
67 views

Replacing a running binary on read-only file system

I have a simple updater bash script, which replaces files by removing the incident old files and copying new files from an archive to the running embedded target root file system. This way, the script ...
3
votes
0answers
101 views

Is there a way to download the presumably initial bash source bash-0.99?

I am interested to check which features the oldest public bash source implements. Is there a way to download this from the net? Google does not help to find anything from before bash-1.14.7.
3
votes
0answers
66 views

Check whether user logged in after hitting “Switch Users”

In Linux Mint, I know that I can use the last terminal command to view when a user last logged into their machine. In my job, however, I often work with employees who leave each day by simply ...
3
votes
0answers
101 views

How to best track adventures of a novice administrator

I have this user that has limited sudo privileges, yet he manages to screw up from time to time. I would like to keep an eye on his adventures, so that I can reverse any damage with less digging. ...
3
votes
0answers
64 views

cursor and combining diacritics in shell

I frequently deal with combining diacritics, especially the combining acute accent (U0301, or \xcc\x81). I have a keyboard set up to insert this character, and that works fine in the shell. $ echo а́ ...
3
votes
0answers
75 views

How do I loop through a list from dconf in bash?

I want to read the list of Gnome Terminal profiles from dconf $ dconf read /org/gnome/terminal/legacy/profiles:/list ['b1dcc9dd-5262-4d8d-a863-c897e6d979b9', '1a3bb41a-5de6-4a23-af30-e70b4b8e5230', ...
3
votes
0answers
202 views

What types of regex DO support (e.g.) negative lookbehind?

Bash on GNU: I am using a collection of find commands, most of which employ -regex to do their matching. Each time I try a different feature in my regex I have to cycle through the values for ...
3
votes
0answers
430 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 ...
3
votes
0answers
240 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
26 views

cd with double slash hangs forever on Mac OS X Terminal

If I type cd // on the Mac OS X Terminal (Version 2.6.1 (361.1)), the prompt hangs forever. Why? Curiously that doesn't happen if I do cd / or cd ///. I am using El Captain with the bash that comes ...
2
votes
0answers
30 views

How to assign different configuration for ttyS0 under different environments

I have a computer (let's call it as DevPC) that sometimes run Linux in native environment and that sometimes run Linux on Xen. I connect this computer to another computer (let's call it as MonitorPC) ...
2
votes
0answers
45 views

put string to commandline

I am making a bashfunction that show a menu binded to pgdown to browse through a a window which list my history (like 4dos/4nt etcetera). I have made so one line is always highlighted. $pos is ...
2
votes
0answers
33 views

Is it possible for bash/readline to “clean up” completion suggestions out the terminal?

If you are using zsh and do a tab completion for commands, pathnames, options etc, whenever there are multiple potential matches the suggestions will be displayed below the prompt. Once you chose a ...
2
votes
0answers
24 views

Trap error on remote server

I have a script that run commands locally, and also execute commands on a remote server via SSH. When an error occurs on the local server, I am able to trap it, send an email and exit the script. But ...
2
votes
0answers
36 views

How to make `script` start and end automatically when working in a certain directory?

I want to use the script program to record my session any time that I am working within a certain directory, such as my ~/projects directory. So for example, I would cd into ~/projects, and script ...
2
votes
0answers
46 views

readline - use of modifiers other than control and meta

I'm trying to use Apple's ⌘ command and ⌥ option keys to map some functions in readline to no avail. As per the man page I used octal values but that doesn't seem to work \xHH the eight-bit ...
2
votes
0answers
26 views

readline - yank resets set-mark

I want to implement this binding "\C-xk": kill-region # turn previous word into HTML/XML # opening and closing tag pair "\C-xh": "\e \eb\C-xk<\C-y>\e </\C-y>\C-x\C-x" but it returns to ...
2
votes
0answers
57 views

Move versus Copy

I've created a bash script that creates a handful of users then creates a .ssh folder and copies in their authorized_keys file. I've made sure to set the owner group to the specific user with ...
2
votes
0answers
54 views

Bash prompt - backspace deletes right aligned text (possible to stop?)

I have a really annoying problem. I have followed all of the protocol for making a bash PS1. I know about surrounding non-printable characters with \[ and \] or \001 and \002; however, I have a ...
2
votes
0answers
39 views

Switch to a specified WiFi network via bash on a Mac

I try to connect to a specific WiFi network in a bash script on a Mac. Two things I want to achieve: Connect to the specified network. I have tried networksetup -setairportnetwork en0 [network_ID], ...
2
votes
0answers
94 views

Understanding inotifywait, pipes and buffers

I want to monitor every file change in a directory with inotifywait. inotifywait shall write to a FIFO buffer, which then can be read, leisurely. While experimenting with relatively huge amounts of ...
2
votes
0answers
67 views

What signal is sent when you close a bash terminal to the programs it was running

I have a bash script that launches a python program. The bash script handles SIGINT SIGTERM and SIGHUP signals to do a cleanup operation. I noticed that when I close the process in a tab in ...
2
votes
0answers
127 views

Why does this pipe not end when the las process dies (zombie)?

I have a script run and monitored by svscan/supervise. When the last luces-hf/run: #!/bin/bash set -v export http_proxy=[redacted] curl -N -s https://[redacted] |\ grep --line-buffered "event" | ...
2
votes
0answers
44 views

Cross-session duplicate removal in bash command history

The problem context: always active ignoreboth and erasedups HIST_SIZE and FILESIZE with desired/practical limits of different history lines for our user almost always have multiple parallel sessions ...
2
votes
0answers
102 views

Why can I change bash history?

Why does bash change the history even I'm not executing a command I'm modifying? For example, if I type: $ echo foo1 foo1 $ echo foo2 foo2 $ echo foo3 foo3 After this, I press up twice, and I get ...
2
votes
0answers
378 views

Fixing my PATH variable

I am perplexed by the following problem and hoping someone can help me fix it: when I type echo $PATH, I get the output: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games However, I ...
2
votes
0answers
367 views

Bash regular expression comparison fail for hex byte \x01

Bash regular expression fails to compare correctly for $'\x01' when End-Of-String char $ is used. All other byte values (seem to) compare correctly. Using GNU bash 4.1.5(1). Is this a bug, or is ...
2
votes
0answers
124 views

Catch/diagnose user process being killed - Inexplicably logged out automatically

Context: I'm using bash in Mac OSX Yosemite. Problem: I'm executing a (python) script that I expect to use alot of resources and take a few hours to run, redirecting stdout and stderr to a log file. ...
2
votes
0answers
135 views

A way to distinguish between interleaved output from two background processes

If I have two backgrounded processes that produce input to STDOUT or STDERR (e.g., two installation scripts), is there an easy way to make these two output streams distinguishable? I guess I can pipe ...
2
votes
0answers
355 views

Unable to create a configuration directory for [FishShell] Please set the $XDG_CONFIG_HOME variable

I'm getting this error when starting fishshell: melanie:~ melanie$ fish fish: Unable to create a configuration directory for fish. Your personal settings will not be saved. Please set the ...
2
votes
0answers
68 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
184 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 ...
2
votes
0answers
33 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
191 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
49 views

How to make netcat print colourful text?

on my Mac I have an peripheral that sends text data to localhost:2332. Some of them are coloured, like this: "\e[1;31mRed text here\e[m normal text here", I use nc loacal host to monitor the data ...
2
votes
0answers
182 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
101 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
528 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 ...