Skip to main content

Questions tagged [interactive]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

Unable to force copy multiple files using single command non-interactively

I wish to force copy a set of files having either the same or different names to a single destination on the same host with a single command onn Solaris. Note: the copy should be forced overrite and ...
Ashar's user avatar
  • 511
0 votes
3 answers
105 views

How to interactively edit a file name from the terminal like with a file manager?

At the command line, one can rename a file by specifying the entire new name to mv mv oldname newname or using a regex with e.g. Perl's file-rename command. rename -d 's/old/new/' oldname But is it ...
Nahoj's user avatar
  • 119
2 votes
1 answer
312 views

Does tmux run-shell support interactive shell?

I know tmux run-shell can execute shell: $ tmux run-shell "echo start; echo \${var}end" start end But what if I want my shell could work interactively or read some user input, $ tmux run-...
Qiu Yangfan's user avatar
0 votes
0 answers
51 views

How to regain script interactivity when `... | bash` best practices?

Let's say we have a simple script named question: #!/bin/bash read -rp "What's your name?" ans echo "Your name is $ans" Let's use cat for our example cat question | bash We ...
punkbit's user avatar
  • 111
0 votes
2 answers
116 views

Change behavior of bash script if executed from another script

I have a script (say Task.sh) (with executable permission): Pseducode: if [[ Not called from inside a script ]]; then echo 'Not called from inside a script' else echo 'Called from a script' fi I ...
Porcupine's user avatar
  • 2,056
0 votes
0 answers
252 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 ...
user56834's user avatar
  • 135
0 votes
1 answer
90 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 ...
Python_new's user avatar
1 vote
0 answers
127 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[@...
khardix's user avatar
  • 11
0 votes
2 answers
61 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 ...
Lee's user avatar
  • 519
1 vote
0 answers
61 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. $ ...
n. m. could be an AI's user avatar
2 votes
1 answer
104 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 ...
Lockszmith's user avatar
3 votes
1 answer
174 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 ...
Remko's user avatar
  • 133
1 vote
0 answers
184 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 ...
Dave's user avatar
  • 621
0 votes
1 answer
992 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 ...
balki's user avatar
  • 4,447
1 vote
0 answers
49 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 ...
AlexC's user avatar
  • 11
0 votes
0 answers
529 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) ...
Matt Alexander's user avatar
7 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 ...
Vi.'s user avatar
  • 5,813
0 votes
2 answers
2k 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 ...
Ashar's user avatar
  • 511
-1 votes
1 answer
63 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 ...
bluesquare's user avatar
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 ...
faeriewhisper's user avatar
0 votes
0 answers
75 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 ...
Pablohoney's user avatar
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 ...
Ashar's user avatar
  • 511
0 votes
1 answer
698 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?
Adrian Lopez's user avatar
0 votes
1 answer
113 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 ...
Tomes's user avatar
  • 21
10 votes
2 answers
12k 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 ~...
artu-hnrq's user avatar
  • 327
1 vote
1 answer
1k 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 ...
matt's user avatar
  • 13
0 votes
1 answer
591 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 ...
ExecutionByFork's user avatar
1 vote
0 answers
60 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 ...
Nir Kellner's user avatar
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 ...
LHeng's user avatar
  • 115
1 vote
2 answers
124 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 > ...
Robert Fleming's user avatar
0 votes
1 answer
91 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: ...
user avatar
0 votes
1 answer
587 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 ...
Eliezer Miron's user avatar
12 votes
2 answers
10k 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 ...
user avatar
0 votes
0 answers
882 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 ...
user avatar
1 vote
0 answers
332 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 ...
Peter R's user avatar
  • 11
1 vote
1 answer
223 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/...
Vlastimil Burián's user avatar
9 votes
4 answers
7k 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 ...
chintogtokh's user avatar
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 ...
Git Gud's user avatar
  • 177
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: ...
Osh's user avatar
  • 11
1 vote
1 answer
4k 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-...
user2901196's user avatar
-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: % ...
stevica's user avatar
  • 143
0 votes
1 answer
800 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 ...
jeremysprofile's user avatar
2 votes
1 answer
724 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.....
Łukasz Lew's user avatar
4 votes
2 answers
3k 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&...
Ole Tange's user avatar
  • 35.8k
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,...
kumar_2000's user avatar
0 votes
1 answer
186 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 ...
Tim's user avatar
  • 103k
1 vote
1 answer
147 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 ...
Vituvo's user avatar
  • 411
5 votes
2 answers
4k 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 ...
林果皞's user avatar
  • 5,206
0 votes
0 answers
77 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 ...
argle's user avatar
  • 523
3 votes
1 answer
435 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 ...
moooxxx's user avatar
  • 39