Questions tagged [interactive]
The interactive tag has no usage guidance.
90
questions
0
votes
0
answers
30
views
Open GUI linux terminal in non-interactive mode
It would be helpful if I can open a terminal and run commands exactly as if they would be run by a non-interactive bash script, to test whether certain commands work in non-interactive mode without ...
0
votes
0
answers
65
views
bash: How to prompt for user input while reading file?
Following script statement for user input is nested in while loop under if block but it doesn't work and is being skipped. How do I get user input to work?
exec 3<&0 && read -p 'Enter ...
0
votes
0
answers
68
views
zsh vared: how to define custom completion?
I would like to launch a command that would read user input and pass each line as a new task to TaskWarrior:
#!/bin/zsh
set -e
while vared -p 'task add> ' -eca task; do eval task add "${task[@...
0
votes
2
answers
51
views
> symbol appearing when interactively defining function in bash
The behaviour of my shell environment changed:
Earlier, when pasting a function definition e.g.
function exampleFunc {
echo hello
}
to the shell, it would display as formatted and register the ...
1
vote
0
answers
57
views
A script causes a parent script to stop
I have a third-party script that runs some complicated stuff.
I run everything from an ssh session (the machine is a headless VM running Ubuntu 20.04).
When I run it interactively, it runs normally.
$ ...
1
vote
0
answers
46
views
Anyway to bind keyboard to dash (Debian Almquist Shell)?
Specifically Up/Down for history navigation.
What I already know
I understand dash is a minimalistic, no bloat, (somewhat) strict POSIX shell.
I understand the philosophy behind it, and the reason ...
3
votes
1
answer
106
views
Running a program outside of terminal
I'm trying to bring up a terminal to interactively ask for a file, and open it using a GUI program:
foot /bin/sh -c 'file=`fzf`;(setsid xdg-open "$file" &)'
I'm using setsid, because ...
1
vote
0
answers
113
views
how to force runuser to initiate an interactive shell the same way `bash -i` is used?
I need to run the following command as mruser as root
systemctl --user status myservice
To do this I use runuser
runuser -l mruser -c "systemctl --user status myservice"
This works perfectly ...
0
votes
1
answer
530
views
How to get color in terminal but no color in output file [duplicate]
To show output in both terminal and to a file, tee can be used like below
ls --color=auto | tee opfile
But now, there is no color in the terminal. If I force colors, opfile also has colors which ...
1
vote
0
answers
34
views
Queue interactive commands and attend to then in sequence
I want to have a script that adds commands to some kind of queue. I then want to run those commands interactively one at a time. More commands should be able to be added to the queue while I'm ...
0
votes
0
answers
385
views
Piping the output of an interactive shell script
Arch Linux's package manager, pacman, outputs search results with each result spanning two lines:
~ % pacman -Ss cowsay
extra/cowsay 3.04-2
Configurable talking cow (and a few other creatures)
...
6
votes
3
answers
1k
views
Is there some interactive analogue of `mktemp` that helps to organize throw-away directories?
I often want a temporary directly where I can unpack some archive (or create a temporary project), see around some files. It is unpredictable in advance for how much time a particular directory may be ...
0
votes
1
answer
1k
views
executing script on remote host using ssh does not return
We have several scripts on remotehost which we trigger from my localhost using ssh like below.
ssh remuser@remhost sh /web/bin/stop.sh
We had OS patching activity this weekend post which the above ...
-1
votes
1
answer
32
views
How can I avoid interactive text UI stage during package installation?
The krb5-user package install on Ubuntu requires the installer to interact with a text UI screen that comes up asking about Kerberos. I'm trying to automate installation and this is one of the points ...
1
vote
3
answers
2k
views
How to run an external program from bash, in an interactive manner?
For instance, if I want to run from a shell script something in python I would do:
echo 'print("hello world")' | python2
Now imagine I want to run something interactive, i.e., it needs ...
0
votes
0
answers
59
views
pdf with form and send mail button that does not work in gnome
I have this pdf form to be filled anytime I need an additional and temporary worker in my restaurant (for example, an additional waiter). The PDF has been created by the government working agency and ...
3
votes
1
answer
2k
views
PasswordAuthentication=no flag does not work on one strange host
On my source REDHAT Linux 7 host i fire this command to never prompt for password and passwordless login
ssh -i /app/axmw/ssh_keys/id_rsa -o PasswordAuthentication=no root@<target-host> -vvv
...
0
votes
1
answer
548
views
Opening an interactive terminal from ranger
Let's say I want to open xfce4-terminal from ranger with a keybind, like
map XX shell myterm
Is it possible? How?
0
votes
1
answer
90
views
Enter subdirectory if current directory is empty
There is one thing that prevents me to discard my GUI-file manager for bash:
Bash does not tab-complete to the only subdirectory in an empty directory.
$ ls
.. // is not displayed, when cmd is ...
8
votes
2
answers
8k
views
Is possible to define a bash script to run interactively by default?
I have written some scripts and stored them in my ~/bin folder. I'm already able to run them just by calling their title during a shell session. However, they aren't running interactively (I mean, my ~...
1
vote
1
answer
769
views
Is it possible to begin a sudo interactive session and also provide an initial command?
A lot of my workflow involves using a sudo interactive session (sudo -i) as a service user that is able to run certain things that my personal username can't. When I do this, I like to preserve my PS1 ...
0
votes
1
answer
546
views
Interactive bash script: Prefix all lines with a string
I want to create an interactive CLI in bash. Similar to the way bash prefixes every line with user@host:~$, I would like to prefix every line with foobar>. This functionality can be seen in CLI ...
1
vote
0
answers
56
views
Filter by default
I'd like to configure my interactive shell (e.g. bash), so that by default all command output will be piped to some filter, e.g. less.
i.e., if I type
# make
it will automatically be interpreted as
...
1
vote
1
answer
2k
views
Opening interactive python shell after running python script in background
python3 -i test.py opens an interactive python shell after running test.py. However, if I try to run it in the background with python3 -i test.py &
the job stops automatically with a ^C and shows
...
1
vote
2
answers
112
views
sh: is there a command to interactively edit the PWD?
I'm looking for a command that invokes readline or similar, primed with the current $PWD, to let the user edit the current directory, then cd to the edited value. E.g.
> cd ~/a/b/c/d
> pwd
> ...
0
votes
1
answer
87
views
Start new shell with positional parameters
With Python, I can start a session with positional parameters:
$ python3 - aa
>>> import sys
>>> sys.argv[1]
'aa'
However it does not seem to be possible with shell:
$ sh - aa
sh: ...
0
votes
1
answer
459
views
Launch interactive app from script
I have an application built in C that uses fgets to read user commands from stdin. I want my embedded linux system to launch this application on startup, and put the user in the terminal of this ...
11
votes
2
answers
8k
views
Zsh clear scrollback buffer
With Bash CtrlL will clear the screen but not scrollback
buffer. In the past I have worked around this by using:
tput reset
However I have noticed that this command will not clear the scrollback ...
0
votes
0
answers
803
views
Zsh disable autofill
Zsh disable autofill
If I open a terminal and enter:
echo 'hello world'
after that if i press e it "suggests" the previous command. How can I disable
this? I tried this with no success:
autoload ...
1
vote
0
answers
306
views
merge commands for line-by-line interactive merging with sdiff, in MacOS unix. Is there a working version?
On MacOS, the sdiff command is described as able to do line-by-line interactive merging, and lists several merge commands for the latest chunk.
e.g. sdiff -o mergefile fileleft fileright
The single ...
1
vote
1
answer
172
views
Confused about determining if a shell script is running interactively
I only want to determine from my POSIX shell script, if it is running interactively, but for some reason, the following function:
running_interactively()
{
printf '%s' ${-} | grep -F i > /dev/...
7
votes
4
answers
6k
views
How can I make rm -rf ask for confirmation just once at the directory level?
If I use rm -rfi, this asks me every time each file is deleted. If I have a list of rm -rf commands, how can I make it so that the machine asks me for confirmation just once (when trying to delete the ...
3
votes
2
answers
1k
views
Copying files interactively: "cp: overwrite"
I'm trying to figure out what words does the -interactive option of cp accepts as input.
For your convenience, here's code that sets up files for experimentation.
touch example_file{1..3}
mkdir ...
0
votes
0
answers
1k
views
How can I prompt users while running a playbook?
My needs: Write a playbook which can install apache if the user wants to, while the playbook is running by typing yes or no.
apache_prompt.yml
hosts: slaves
vars_prompt:
- name: ...
1
vote
1
answer
3k
views
interactive SMTP command using telnet via a shell script
I'm trying to access a SMTP remote server thru a remote shell using telnet and a command file command.txt containing command to send to that SMTP server as seen on https://tecadmin.net/ways-to-send-...
-1
votes
2
answers
6k
views
csh if statement interactive use
Either there's something fishy with my Solaris 10 csh implementation of if statement or I don't get something right (of course the second is very well probable in my case at least) but when I do:
% ...
0
votes
1
answer
744
views
Run bash subshell with commands as other user and not return to parent shell
As part of my quest to preserve bashrc and vimrc when switching to non-root users, I plan on making some super ugly aliases to switch to other users, immediately execute some commands, and then drop ...
2
votes
1
answer
685
views
How to trap INT signal infinitely many times?
I'm piping output of an interactive command (ghci) through sed-based script to add some colors:
ghci | colorize.sh
where colorize.sh is something like:
#!/bin/bash
trap '' INT
sed '...some pattern.....
4
votes
2
answers
2k
views
Non-ascii chars are no longer displayed in bash
Updated: This is not a file system problem.
I used to be able to enter:
$ echo kødpålæg
But now bash/zsh change this to:
bash$ echo kddddddddplg
zsh$ echo k<c3><b8>dp<c3><a5&...
2
votes
1
answer
2k
views
how to pass value for interactive jar file in shell script
We are using oswatcher in our environment which runs and collects diagnostic information on Redhat linux 5.6 /6.4 versions. This is scheduled under root which runs and collects information on iostat,...
0
votes
1
answer
167
views
Can you enumerate all the ways to start an interactive shell?
Bash manual says:
An interactive shell is one started without non-option arguments, unless -s is specified,
without specifying the -c option, and whose input and output are both connected to ...
1
vote
1
answer
116
views
Type Y to Delete, if the script is being executed manually
This is a 2 part question.
Scenario: This script is on a cronjob. If a folder does not exist, the system sends us an email that opens a ticket which notifies us that the folder is not available. We ...
5
votes
2
answers
3k
views
Why no such non-interactive version of bashrc?
From what I understanding, a daemon is a background process, but daemon requires unique config file to set the environment variable.
E.g. Hadoop daemon require hadoop-env.sh to set environment ...
0
votes
0
answers
76
views
How do I copy to clipboard text I cut with Ctrl+U? [duplicate]
In an interactive shell session, how do I copy to clipboard text that was cut with Ctrl+U? Without using the mouse, obviously. Thus making it available for other GUI applications, instead of pastable ...
3
votes
1
answer
422
views
Why is Linux allowed to become unresponsive? [closed]
This question Why can a system become unresponsive? comes close. The answer kind of explains what is likely happening, but I just don't understand why this problem hasn't been solved since at least ...
4
votes
0
answers
5k
views
Bash script calls python script that wants interactively input ( not only arguments )
I have a bash script bash.sh that looks like this:
#!/usr/bin/env bash
/usr/local/sbin/pythonScript.py firstArgument secondArgument
If I call the pythonScript.py from my terminal with the two ...
3
votes
1
answer
2k
views
Making mysql CLI ask me for a password interactively
I use the following code as part of a much larger script:
mysql -u root -p << MYSQL
create user '${DOMAIN}'@'localhost' identified by '${DOMAIN}';
create database ${DOMAIN};
GRANT ...
2
votes
1
answer
1k
views
Non-interactive & non-login shell environment?
I'm trying to understand non-interactive & non-login shells and having a hard time conceptualize the process a non-interactive & non-login shell goes through to start up.
The way I ...
1
vote
1
answer
837
views
rm -iR does not work inside a loop
Here is my loop
ls -ltrd * | head -n -3 | awk '{print $NF}' | while read y; do
rm -iR $y
done
output:
rm: descend into directory oct_temp17? rm: descend into directory
oct_temp18? rm: ...
4
votes
2
answers
4k
views
Which file is loaded and executed by a non-interactive non-login shell?
A non-login interactive shell (for example: when I open a Terminal window in Ubuntu) loads and executes the file ~/.bashrc.
Now when I execute a shell script, a non-interactive non-login shell ...