Linked Questions
18 questions linked to/from Can bash write to its own input stream?
2
votes
0
answers
41
views
Is possible to set the command line line (not prompt) from another program? [duplicate]
I hope that this question won't be too ambiguous.
I would like to achieve following thing.
[user@host]# ./my_program SET THIS AS NEXT COMMAND THAT YOU CAN EDIT
[user@host]# SET THIS AS NEXT COMMAND ...
0
votes
0
answers
23
views
Print to command line [duplicate]
I use bash 4.4.
How do I print the a file to command line.
For example,
$ printf "HELLO" > file
$ my-command file
$ HELLO
where the HELLO in the last line shows after the second command is run.
...
27
votes
7
answers
3k
views
Bending a pipeline back into its origin
One might think that
echo foo >a
cat a | rev >a
would leave a containing oof; but instead it is left empty.
Why?
How would one otherwise apply rev to a?
34
votes
3
answers
4k
views
Execute a readline function without keybinding?
I was just reading the readline man-page and discovered a bunch of great commands I didn't know about. However, several don't have default key bindings. Is there a way to execute the unbound commands ...
6
votes
2
answers
1k
views
Is there a way to define a bash readline command? [closed]
I can not find a way to do that from bash. So Is there a way to define a bash readline shortcut that will insert a dynamically generated string at the position of the cursor?
E.g., I want to insert ...
10
votes
1
answer
6k
views
How do I come by this pty and what can I do with it?
It seems that a simple shell redirect from /dev/ptmx gets me a new pseudo-terminal.
$ ls /dev/pts; ls /dev/pts </dev/ptmx
0 1 2 ptmx
0 1 2 3 ptmx
It disappears as soon as the process that ...
4
votes
4
answers
2k
views
Change dir from script without a "shell procedure" or "sourcing the script"
I know what I can make a shell procedure or source the script instead of running it to cd the shell I am using. What I want to know is there any way to cd the "parent shell" (not sure if that is the ...
5
votes
3
answers
281
views
Output Output of command to command line directly, NOT variable [duplicate]
I am on the bash shell and I want the output of a command to appear directly in the command prompt that appears after the command has executed !
Example of what I envision it, to illustrate my idea:
...
3
votes
1
answer
2k
views
Redirecting the stdout of a process to its own stdin
I was thinking about self-referential lists in Haskell - for example you might
have the following script, fibonacci.hs:
#!/usr/bin/env runghc
fibs :: [Integer]
fibs = 1:1:(zipWith (+) fibs $ tail ...
4
votes
1
answer
2k
views
How to always print the prompt on a new line & keep input
We all know this annoying issue:
$ printf "abc" > some-file
$ cat some-file
abc$
which tends to mess up the prompt if it is any more complex than $, throws off the current cursor position and ...
0
votes
4
answers
1k
views
How to fill terminal input line from file contents?
I'm trying to replicate the behavior of the history builtin: specifically when you do !<line # of command> and it's just replaced with the command at line #.
Let's say that I have a file with ...
1
vote
1
answer
657
views
Running a command on different shells
While reading the answers of question Can bash write to its own input stream?, I found the following command runs on zsh but not on bash :
print -z echo mnciitbhu
1 . Is -z an extension to the print ...
8
votes
1
answer
325
views
How can a shell output affect the typed text after the command prompt?
I have experienced similar behaviour before, but only now I can reproduce it: Output from a command affecting the text after the next command prompt, ready to be Entered by the user.
Take the ...
3
votes
1
answer
226
views
View text in kill-ring
Is there a way to view your entire kill-ring besides repededly hitting M-y
Somthing like emacs browse-kill-ring but for the shell
0
votes
1
answer
536
views
xdotool type and stty occasionally cut off first letter of input
I defined a simple function prepend (below) that should automatically place a repeated term of a bash command in the following input prompts. For example, by typing prepend git in the terminal, all ...