Questions tagged [user-input]

The tag has no usage guidance.

0
votes
0answers
40 views

Can I target the source xinput device when requesting input?

Sticking a yubikey in my computer I see, $ xinput --list ... ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [...
0
votes
1answer
87 views

How may I detect if the number of input is within the limit

I want to read three inputs and want to count them so that I can display a custom error message if the user inputs less than three or more than three. The code for the program I'm trying to write is ...
1
vote
4answers
91 views

Why do control-left and control-right (arrow keys) not navigate by word in `less`?

In less's line editing mode, the left and right arrow keys move the cursor backwards and forwards. I was hoping to use these together with the control key to navigate by word, as promised by man less. ...
0
votes
0answers
60 views

Output the beginning and length/end of no keyboard and mouse use intervals

Gnome keeps track of intervals of no keyboard and mouse use. Xorg also needs this for its Option "BlankTime" option in /etc/X11/xorg.conf. What is a shell command to return such intervals (beginning ...
0
votes
2answers
446 views

Removing login username password screen to Autologin

I am using UP Board. IT has Ubilinux installed in it. I have made a browser kiosk so that it automatically logs in to the browser full screen mode but I am having an issue on reboot. Whenever I try to ...
0
votes
1answer
13 views

loop user inputted string in script

trying to make a basic addition function that adds the numbers entered and outputs a total. Here's my current function: function addition() { read -a arr for i in ${arr[@]} do ...
-1
votes
1answer
52 views

How to check every file in directory and ask the user to do action in csh shell

The actions I would like to do with this script is to Read the name (without base) of each file in a directory For each file, ask the user if he wants to perform an action (e.g. move the file in a ...
2
votes
4answers
1k views

Pasting multiple commands into terminal stops at user input

Pasting some consecutive commands into terminal stops on commands with user input, e.g.: read VAR echo $VAR or select VAR in 1 2 3; do break; done echo $VAR echo $VAR is not getting pasted/...
0
votes
1answer
200 views

Give default path for id_rsa in a shell script

I want to automate user creation along with the rsa key generation in a shell script. But while generating the rsa key we need to give inputs for these three things. Enter file in which to save the ...
0
votes
2answers
2k views

Wait for keyboard input inside a while-read loop

I have a bash script with a construction like this: while read foo bar baz; do echo "Processing $foo $bar $baz" # more code here done < /etc/somefile Inside the loop, I would like the ...
0
votes
1answer
33 views

New to Unix, want to create a simple user input to restart or leave the program [closed]

I am making a program and want a simple echo asking if the user wants to Order again, or Leave the program. It's in Shell on Unix The program is simple echo and reading of variables of ordering food. ...
0
votes
1answer
161 views

Replace line in text file with user input at terminal

I am trying to prompt the user for two pieces of information: 1) The line number in the file to be changed 2) The value to change it to. My script so far: echo "Do you wish to enter a variable to ...
1
vote
1answer
137 views

How to use linebreak in read -p command while using variables in prompt string

I want to have a line break after prompt while using the cowsay function in the prompt : read -p "$(cowsay "do you know this word?") \n" answer there are multiple answers to this problem : 1)https:/...
0
votes
1answer
199 views

Move alias command to the background when password is requested

I prepared an alias to start my tightvnc viewer: alias vnc='/usr/bin/xtightvncviewer MOC' It worked. It asked me for the password and ran the vnc. But it prevented to put next commands in the same ...
2
votes
1answer
287 views

Pausing in GNU parallel and waiting for character

I would like the timing pause to be replaced with the equivalent of a getchar() in a GNU parallel execution: parallel -j2 --halt 2 ::: 'sleep 5m; return 1' './runMe' However the following does not ...
3
votes
4answers
8k views

How can I enable/disable the synaptics touchpad in Debian 9 with libinput?

I recently upgraded from Debian 8, to Debian 9 stretch. Apparently they no longer utilize synaptics /synclient to control touch-pad input. What I am looking for is a simple command to enable or ...
1
vote
1answer
3k views

Automatically input “yes” on the bash file [closed]

Slurm is workload manager. There are two kinds of modes to run job, interactive(srun) and batch mode(sbatch). When using interactive mode, one needs to leave the terminal open which may lead extra ...
3
votes
2answers
1k views

Wait for a process to finish OR for the user to press a key

I need two ways to terminate a part of my bash script. Either a counter reaches a predefined number, or the user manually forces the script to continue with whatever the value the counter currently ...
5
votes
1answer
1k views

How to signal end-of-input to “read -N”?

I've been trying to figure out why I get a literal end-of-transmission character (EOT, ASCII code 4) in my variable if I read Ctrl+D with read -N 1 in bash and ksh93. I'm aware of the distinction ...
1
vote
2answers
2k views

Bash function assign value to passed parameter

I've got the following situation: I'm writing a script that will read its parameters either from a config file (if exists and parameter present) or asks the user to input said parameter if it's not ...
2
votes
1answer
20k views

Bash script - Automatically enter user input (password of keystore)

I know this has been asked before but almost only workarounds have been provided. None that solved my problem just yet. I'm trying to create my own .sh file which will generate an apk. After using ...
7
votes
2answers
5k views

How to read the user input line by line until Ctrl+D and include the line where Ctrl+D was typed

This script takes the user input line after line, and executes myfunction on every line #!/bin/bash SENTENCE="" while read word do myfunction $word" done echo $SENTENCE To stop the input, the ...
2
votes
1answer
563 views

Script using user input to calculate old date

I have numerous of log files that I have to move from a production directory into an archive directory. I need to move them by creation date. Files from January 2016 go into an archive directory ...
0
votes
1answer
64 views

read 1 or several lines in bash - make it work when pasting (in addition to typing manually)

I read multiple answers with varying complexities. Most are working well when the input is typed manually. For example: https://stackoverflow.com/a/20913871/1841533 . Here is my sample code, very ...
1
vote
1answer
50 views

Python `read -n1 var`?

Is there a Python 3 module that allows to input a single character, without having to press Enter afterwards? Like Bash's read -n1 var?
0
votes
1answer
992 views

Bash script to add or subtract two numbers from user input

I am very new to Linux and am taking a course in it. Very excited to learn more. I am working on a script that asks user for two numbers, then asks whether user wants to add or subtract. I failed the ...
0
votes
2answers
436 views

pausing a loop in AIX to wait for user input

I'm searching for a scripting mechanism that can realize the following idea. Loop over a list and stop/wait on "read x" until the next input from a user. I know the following script is not working! As ...
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 ...
1
vote
1answer
417 views

Block user input on interactive shell using “cat /dev/ttyS0”

I created an update routine for my device. The update process can be started using the serial console, SSH, telnet, a webserver or a REST API. Once the update started, I want to block all user input ...
2
votes
2answers
7k views

Inputting user input automatically through bash script? [duplicate]

I am creating a bash script which creates a user and sets a password. When the command "passwd user" is run it requires the user to enter a password and stops my script. Is there any way to fulfill ...
2
votes
0answers
468 views

How can you get the current terminal line (the one that is still editable by the user)?

I need a way to use the current line which the users typed into as variable for a shell function. my current code, which can be called by ctrl+r zle -N search bindkey "^R" search search () { read ...
9
votes
4answers
9k views

How to read user input from a pipe?

Let's assume I have a file named confirmation.sh with the following content: #!/bin/bash echo -n "Are you sure [Y/n]? " read line case "$line" in n|N) echo "smth" ;; y|Y) echo "smth" ...
1
vote
1answer
815 views

Shell script to backup VMware VM's, exporting each VM to a list then asking user intput

What I'm Trying To Accomplish: Get list of Virtual Machines ".vmx" file and place in variables Give the user and choice of which VM to backup Use "ovftool" to produce an export of the chosen VM to a ...
0
votes
2answers
1k views

How to create as many variables as needed from shell script(bash)?

I'm making a script for monitoring some user processes with Upstart but, since its for the company I work for, they asked me to do it generic...how's so? Well, the number of processes being monitored ...
1
vote
0answers
141 views

Decreasing mouse sensitivity at kernel level

I have developed a custom-GUI Server, which runs on virtual console of Linux.For mouse-handling purpose, it reads the mouse device file /dev/input/mice and retrieves the event data and updates the ...
14
votes
3answers
38k views

How to take 'password' like input in shell script? [duplicate]

Possible Duplicate: How to hide commands typed in a Linux shell? Reading passwords without showing on screen in Bash Scripts I would like to take a password as input, but I want user to be able ...
9
votes
2answers
4k views

Requesting user input while reading file line by line

For class I need to write a Bash script that will take the output from ispell and when I try and request user input inside the while loop it just saves the next line of the file as the user input. ...
1
vote
1answer
3k views

Capture user input while doing other things

Is there a way to have the output of a subprocess (something other than 'sleep' below) be dovetailed with the output from a foreground command-loop? For example: while true do echo "updating ...