Questions tagged [interactive]

The tag has no usage guidance.

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

Taking a line of input from the keyboard, and put it in an EXPORTed environment variable - in a single line command

In bash shells, I want to be able to set EXPORT variables by reading one line of typed text from the keyboard. I can currently do this with two separate commands: read MYVARNAME export MYVARNAME ......
0
votes
1answer
22 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
1answer
45 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 ...
0
votes
0answers
25 views

Executing a Program with input

I would like to be able to run a program and then feed that program some information all in one line on startup. Suppose I am in the working directory of the executable (sage), I can run ./sage -c "...
0
votes
0answers
19 views

sudo: limit interactive shells?

I have a third-party application that runs on Linux. The application runs as a specific (non-root) account and provides a quite complicated environment to that user. Without an interactive shell as ...
0
votes
0answers
30 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
1answer
227 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
2answers
66 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
1answer
49 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
1answer
24 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 ...
2
votes
1answer
598 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
0answers
58 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
0answers
56 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
51 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/...
3
votes
3answers
906 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
95 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
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
0answers
551 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
1k 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
1k 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
295 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
334 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
468 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
697 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
96 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
55 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
73 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
912 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
37 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 ...
2
votes
1answer
320 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
3k 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
738 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
713 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
393 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: ...
2
votes
2answers
930 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
1answer
502 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
40 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
177 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
3k 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
1k 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
396 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 ...
4
votes
2answers
15k 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
347 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
222 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
7k 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
87 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
157 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 ...
1
vote
2answers
1k 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
439 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
578 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'...