10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
#!/bin/bash
#Just trying to check if letters are in the user input. Any tips?
# I have tried regexp and using 0-9 etc, i cannot get this to work either in just an if statement or while in a loop.
echo "Please pick a number"
read num
if ; then
echo "Please enter a number"... (7 Replies)
Discussion started by: jvezinat
7 Replies
2. Shell Programming and Scripting
Hi,
This query is a part of a much more lengthy script.
I wish to look for all the files in a folder named "data" which in this case has two files i.e. plan.war and agent.properties. For all the files found under data I wish to ask the user as to where they wish copy the files to.
Below,... (14 Replies)
Discussion started by: mohtashims
14 Replies
3. Shell Programming and Scripting
Hi, I have written a script that allows me to repetitively play a music file $N times, which is specified through user input. However, if I want to exit the script before it has finished looping $N times, if I use CTRL+c, I have to CTRL+c however many times are left in order to complete the loop.... (9 Replies)
Discussion started by: hilltop_yodeler
9 Replies
4. Shell Programming and Scripting
Hi Dears,
I have one script to create new users with information in one plain text file. This script will read all lines in the file and create one users for one line.
Sample file:
#action;login,full name title,expire date,project
+;gmwen,Bruce Wen QA,04/01/2012,BT
+;xxdeng,Shown Deng... (4 Replies)
Discussion started by: crest.boy
4 Replies
5. Shell Programming and Scripting
until
do
read -p "Invalid cars. Try againa" cars1
done
Ok i have the above code, im getting users input and if it doesnt match in the file the user has to try again untill its correct
But when i run this it gives me an error saying
./Cars.bash: line 43: (2 Replies)
Discussion started by: gangsta
2 Replies
6. Shell Programming and Scripting
Here is the smallest extract to demonstrate the problem that I experience.
#!/bin/bash
r=$1
while read ip
do
if ] ;then
x=`ssh $ip echo "$ip"`
else
x=`echo "$ip"`
fi
echo $x
done << EOF
192.168.8.241
192.168.8.241
EOF
# Any IP with public key set (0 Replies)
Discussion started by: ivolvo
0 Replies
7. Shell Programming and Scripting
Using ls input as example..
ls | sed 's/\n/ /'outputs with line breaks, where I was expecting the \n to disappear. I've tried \r as well wondering if terminal output used different breaks.
Is there a way to remove the line breaks without saving to file and then working from there?
----------... (2 Replies)
Discussion started by: davidpbrown
2 Replies
8. UNIX for Dummies Questions & Answers
I'm new to BASH and i'm trying to create a script which is simply put a large find and replace file. This is what I have so far
N=0
while read LINE ; do
N=$((N+1))
sed 's/'$2'/'$3'/g' $LINE > .temp
echo "Changes to file $N = $LINE"
echo 'The following changes... (5 Replies)
Discussion started by: Azumandious
5 Replies
9. Shell Programming and Scripting
Hello, i know how to retrieve a user input (read), and how to manage the different options (case statement).
But... could anybody show me a script that, if the user option is incorrect, don't allow to continue the excution, i.e., if the value entered is not 1 or 2, the script shows a question.
... (2 Replies)
Discussion started by: aristegui
2 Replies
10. UNIX for Dummies Questions & Answers
hi!
i need to do a ksh script that uses a wile loop that is fed form below
while read line
do
some things
done < myfile
inside the while loop i need to read user input to ask the user what he wants to do, but "read" reads the file, and not the standard input
while read line
do
... (2 Replies)
Discussion started by: broli
2 Replies