10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm trying to use a bash script for a psych experiment that involves listening to sound files and responding. If I have something like the code below, how can I make sure that a key press is assigned to RESPONSE only after the second echo statement?
for i in 1 2 3; do
echo "Ready?"
sleep 2
... (10 Replies)
Discussion started by: darwin_886
10 Replies
2. Shell Programming and Scripting
I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :).
The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies
3. UNIX for Dummies Questions & Answers
The (longer) script that I am working on does something like this:
#!/bin/bash
while true
do
clear
sleep 1
shuf -i1-2 -n1
sleep .1
clear
echo "Press 1 if you saw a 1. Press 2 if you saw a 2."
read -s -n1 RESPONSE
done
If the user accidentally presses two... (1 Reply)
Discussion started by: darwin_886
1 Replies
4. Shell Programming and Scripting
How to check the user input to be valid using shell script?
The valid input is in the format like as follows.
1. It can only have r,w,x or a hyphen and nothing else.
2. ensure the r, w, x are in the correct order.
for example: rwxr-xr-x is a valid format.
Thanks (5 Replies)
Discussion started by: hyeewang
5 Replies
5. Shell Programming and Scripting
i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled.
#!/bin/sh
echo " Enter your choice to continue y/Y OR n/N to quit "
read A
if
then
echo " user requested to continue "
##some commands... (7 Replies)
Discussion started by: only4satish
7 Replies
6. Shell Programming and Scripting
Please tell me how to write a perl script that asks the user to enter words and that passes them to a variable.
In bash, the "read" command would achieve such user interaction.
#!/bin/bash
read -p "Enter files: " vFiles
However, I am looking for perl version of something equivalent... (2 Replies)
Discussion started by: LessNux
2 Replies
7. Shell Programming and Scripting
Hi everyone,
I cant seem to figure this out for the life of me. Basically, I have two arrays..
sub init {
use Getopt::Long;
use Data::Dumper;
my @selections = ();
my @valid_options = ( "vaild1", "valid2" );
GetOptions( "input=s" =>... (2 Replies)
Discussion started by: ckozler
2 Replies
8. Shell Programming and Scripting
Here is my script:
echo "var 1:"
read varone
echo "$varone"
When I run in via ksh the script runs successfully.
However when I run it via tcsh I get "varone: Undefine variable"
Does the name command not work with tcsh or do I need some additional modification? Is there a way to get... (1 Reply)
Discussion started by: bonesy
1 Replies
9. Shell Programming and Scripting
how do we read input from a user
e.g i want to ask a user to enter 6 sets of numbers
how do i control information from the user?
i have this.......
#!/bin/bash
echo "Please enter six numbers"
read number
echo $number >> file1
but this stops after the first number..how can i... (2 Replies)
Discussion started by: vadharah
2 Replies
10. Shell Programming and Scripting
I am trying to create a shell (ksh) which has two "read" commands, one which reads a line from a file and another which is inside a loop that reads user input from a keyboard. However, the "read" command inside the loop uses the input from the file and it does not get the user input from keyboard.... (3 Replies)
Discussion started by: stevefox
3 Replies