Unanswered Questions
3,010 questions with no upvoted or accepted answers
18
votes
1
answer
3k
views
zsh can't input to terminal when piping stdin and stdout with variable command that has tty output
System info:
macOS Sierra 10.12.6
zsh 5.4.2 (x86_64-apple-darwin16.7.0)
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)
Scroll to the EXAMPLES at the bottom if you just want to dig in ...
7
votes
1
answer
2k
views
Moving cursor to end of line when using history-search-backward
I recently added the following lines to my .inputrc:
"\e[A": history-search-backward
"\e[B": history-search-forward
However, I noticed when using this that my cursor does not jump ...
6
votes
0
answers
494
views
Colorize the PS4 prompt?
With the option set -x, each command is echoed to STDERR before execution, prefixed by the expanded $PS4, with the first character being repeated according to the call stack depth.
I want the output ...
6
votes
0
answers
389
views
Bash completion own compgen prefix
I have a simple bash completion script that essentially invokes my (non-bash) program and set its output to COMREPLY, i.e.
COMPREPLY=( $(my-program -- "${COMP_WORDS[@]}") )
Some of the options accept ...
6
votes
1
answer
1k
views
bash/gnu readline multiline command: move row up/down
How to move one editing row up (back) or down (forward) in a multi-line command in bash/readline?
Somethnig like gj/gk in Vim.
5
votes
1
answer
545
views
Why does bash print exit even when it does not exit - is this a bug?
exit with zero or one numeric argument like exit or exit 42 print "exit" and exit the shell.
exit with an invalid argument like exit hello prints an error message, prints "exit" ...
5
votes
0
answers
2k
views
How to have the results of an `fzf` selection enter my bash history?
FZF is a lovely tool, the main issue I have is that the commands I end up running with it don't end up in my bash history.
Let's say I do this
history | fzf
And I choose a command I ran recently, say ...
5
votes
0
answers
1k
views
Kernel module remove not permitted for some sudo users
I use a sudoers file, which (besides other items) contains following lines:
homebridge ALL=(ALL) NOPASSWD: /sbin/modprobe -r bcm2835-v4l2, /sbin/modprobe bcm2835-v4l2, /sbin/reboot
%sudo ...
5
votes
1
answer
1k
views
wget exit code with -nc
If I try downloading a file which already exists with wget using the --no-clobber option, it works as expected but the exit code is 1 which is crashing my scripts. Why is the exit code 1 and how can I ...
5
votes
1
answer
651
views
bash + how to avoiding duplicate entries in authorized_keys (ssh) in bash
Popular methods of adding an ssh public key to a remote host’s authorized_keys file include using the ssh-copy-id command, and using bash operators such as >> to append to the file.
An issue ...
5
votes
0
answers
594
views
Is there a command like `time` that monitors the network traffic of commands?
I can use the time command to measure the time some command takes:
time node -e ""
node -e "" 0.06s user 0.01s system 92% cpu 0.076 total
Is there a similar way to measure a ...
5
votes
0
answers
238
views
On MacOS, what character does `Esc+` or `+Esc` correspond to in Bash, when using iTerm2 terminal?
I've read that mapping Left Option key to Esc+ should fix many of the issues users of Bash, on MacOS, have with GNU Readline key-bindings.
However, I've never encountered Esc+ or +Esc before, so does ...
5
votes
0
answers
1k
views
Merge stdout and stderr, and create copies of each separately
My goal is best explained by example. To start, here's
a function that will produce sample output, on both stdout and
stderr:
output() {
printf '%s\n' 1 2
printf '%s\n' errA errB 1>&2
...
5
votes
1
answer
1k
views
How can I properly use an American flag emoji in my bash prompt?
I want to use an American flag emoji in my bash prompt (i.e. PS1 environment variable). However, the American flag emoji causes the terminal cursor to offset an extra character to the right.
🇺🇸 is ...
5
votes
3
answers
5k
views
How to execute script on remote server after loggin in through ssh
I'm managing a bunch of servers so I frequently have to ssh into them. I'd like to automatically run a basic custom script on whatever remote server after logging in. Say to set up some aliases, ...