Skip to main content

Questions tagged [user-input]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

Displays a user input pop-up on the Android screen

Currently I'm interested in Bash and also the Android phone I have... I'm wondering if there is a way to display popup as text input on the android screen and then receive data from that user-...
TuanHaxor's user avatar
1 vote
0 answers
25 views

How do I request a user input with GUI from script running as root by modern initialization system?

I have Systemd service of type "oneshot" to be launched by Udev upon a device insertion. Service is launching shell script as root. The script needs user input in order to do it's job as ...
Asc's user avatar
  • 11
0 votes
2 answers
417 views

Source script with user input

I have a script that is something like #!/bin/bash echo -n "User: " read -e username echo -n "Password: " read -es password export http_proxy="http://$username:$password@...
Noriller's user avatar
  • 111
4 votes
1 answer
539 views

Put a specific file in every Unix user's home directory when they're created and added to a particular group

How can I set up my Solaris system so that every time a user is created and assigned to a specific group, a specific file is placed in that user's home directory?
Nestor's user avatar
  • 41
1 vote
1 answer
374 views

Read file from user input with a list of prefixes, then call file with prefixes in while loops

I am trying to direct user input file into while loop, but kept on failing when ran the script. The user input file genelist contained a list of numbers where I have been using as prefixes of my other ...
web's user avatar
  • 193
0 votes
1 answer
2k views

How can I take multiple inputs from a user and convert to a string that looks up values and adds them to a variable?

I have a script that takes input from a user (options 1, 2, 3, etc.) to choose files to deploy to a remote server. Instead of the user running this script multiple times, I would like for them to be ...
oakenshield's user avatar
0 votes
1 answer
574 views

why perl's if condition is satisfying empty string?

The below code works fine, except for the part the STDIN takes an empty value also and goes to first selection "print "Selected Y \n";". If I use && $check ne "" )...
prado's user avatar
  • 940
2 votes
2 answers
2k views

Read from terminal without waiting for [ENTER]

I'm sorry to bother you with such silly questions, but I recently started working with the Linux terminal and when I was reading a paper about the command stty I found the following question: ¿How ...
Commodore's user avatar
1 vote
1 answer
3k views

Set variables via user input and check all variables have been set before continuing script

I'm building an automated bash script that will install and configure several packages on a Linux Server. I'm hoping to re-use this script on multiple servers but change some parameters accustom to ...
willowen100's user avatar
1 vote
1 answer
2k views

Why does read appear to fail silently in my script called from another script?

Let me paint a picture for your. You write some deployment scripts or build scripts or somethings etc. which run commands on the remote to do things like e.g. create users, install/update package etc. ...
Timo's user avatar
  • 633
8 votes
2 answers
6k views

bash script - request input via gui

I'm currently writing a nemo action script in bash, and I need a way to get input from the user. How?, the terminal isn't showing when running an action script. is there anyway to popup a query window ...
JoBe's user avatar
  • 397
2 votes
2 answers
563 views

How can I modify input variables with string modifiers in zsh?

I've been working on a bold function as a proof-of-concept and a challenge to myself. I am trying to input text (e.g.foo) and have it print to standard output as it's bold counterpart (foo). Context: ...
user426441's user avatar
0 votes
1 answer
70 views

Printing all lines between two strings, with one as a user input, using sed [duplicate]

I'm trying to use: sed -n '/String1/,/String2/p' Filename to print all lines between String1 and String2. Although I want to add String1 as a user input so, read $userinput sed -n '/$userinput/,/...
Richard's user avatar
-1 votes
1 answer
3k views

How to create a shell script that would create a copy of a file (selected by the user) and copy it to a directory (selected by the user) in Bash?

How to solve this task? To create a copy of a file. The file should be in your current directory (the name of the file to be given by the user) The destination directory name to be ...
Angelism's user avatar
2 votes
1 answer
1k views

Script that validates 3 inputs

This is what I have. I am trying to validate 3 inputs. The first and the second inputs do not ask me to enter the correct input. What is wrong? #!/bin/bash ...
Peter Thapelo Matlhasi's user avatar
4 votes
2 answers
3k views

zsh script prompt reading single keystroke: add newline when appropriate?

I have a script that takes an -i flag (→ $interactive) and if set, asks a yes/no-default-no question for each target, à la rm -i and others. Zsh’s read -q is designed for this exact case—it accepts a ...
Trey's user avatar
  • 292
0 votes
1 answer
3k views

How do I test the output of grep, with an if statement

I need to use an if statement to respond to a blank output. I've got: while read -p "Enter filename: " do Extant=$(ls | grep $name) echo "$Extant" to store and display the results. that's fine... ...
ASather's user avatar
2 votes
2 answers
705 views

How do I prompt for user input using $EDITOR from a script?

I want to have an input mechanism akin to git commit. When the script is run, it should open an editor to edit a temporary file, use this file as my input, and then get rid of the file.
Atilla Filiz's user avatar
0 votes
1 answer
394 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 ...
Niranjan Bogati's user avatar
2 votes
4 answers
2k 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. ...
David Robertson's user avatar
0 votes
2 answers
2k 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 ...
Usman Khan's user avatar
0 votes
1 answer
28 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 ...
treyBake's user avatar
  • 389
-1 votes
1 answer
967 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 ...
S. Carli's user avatar
5 votes
4 answers
13k 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/...
pLumo's user avatar
  • 22.7k
0 votes
1 answer
1k 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 ...
TheDataGuy's user avatar
2 votes
2 answers
9k 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 ...
user149408's user avatar
  • 1,333
0 votes
1 answer
42 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. ...
Dillan's user avatar
  • 31
0 votes
1 answer
409 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 ...
Gregory's user avatar
  • 103
3 votes
1 answer
2k 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:/...
Grunwalski's user avatar
0 votes
1 answer
553 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 ...
trzczy's user avatar
  • 650
2 votes
1 answer
523 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 ...
baptiste's user avatar
7 votes
4 answers
19k 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 ...
bitbox's user avatar
  • 131
3 votes
1 answer
15k 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 ...
Rilin Shen's user avatar
4 votes
2 answers
3k 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 ...
unfa's user avatar
  • 1,745
6 votes
1 answer
2k 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 ...
Kusalananda's user avatar
  • 339k
1 vote
2 answers
4k 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 ...
Baz's user avatar
  • 111
6 votes
2 answers
57k 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 ...
Ivaro18's user avatar
  • 161
9 votes
3 answers
22k 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 ...
user123456's user avatar
  • 5,088
2 votes
1 answer
1k 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 ...
saltycomms's user avatar
0 votes
1 answer
211 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 ...
Olivier Dulac's user avatar
1 vote
1 answer
70 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?
joH1's user avatar
  • 908
-1 votes
1 answer
5k views

Bash script to add or subtract two numbers from user input [duplicate]

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 ...
IWhite's user avatar
  • 11
0 votes
2 answers
728 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 ...
user3432121's user avatar
1 vote
1 answer
816 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 ...
Dakkaron's user avatar
  • 2,057
2 votes
2 answers
13k 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 ...
user3024130's user avatar
4 votes
1 answer
2k 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 ...
HopefullyHelpful's user avatar
11 votes
4 answers
14k 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" ...
Igor Timoshenko's user avatar
1 vote
1 answer
2k 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 ...
BsdHelper's user avatar
0 votes
2 answers
2k 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 ...
Edgar Sampere's user avatar
1 vote
0 answers
254 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 ...
manmatha.roy's user avatar