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
i am having file like this
#!/bin/bash
read -p 'Username: ' uservar
match='<color="red" />'
text='this is only a test
so please be patient
<color="red" />'
echo "$text" | sed "s/$match/&$uservar\g"
so desireble output what i want is if user type MARIA
this is only a test
so please... (13 Replies)
Discussion started by: tomislav91
13 Replies
3. Shell Programming and Scripting
I am trying to create a bash script that will create new function by using the user input. The below will create the necessary files in the correct format, however when it comes to the # create function I am at a loss.
If the name entered was NEWNAME and the genes were GENE1,GENE2 then two files... (0 Replies)
Discussion started by: cmccabe
0 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
Hi,
On my Java webpage which invokes the shell script has two checkboxes viz ...
apache
and
weblogic
apache require one parameter i.e apache home from the user while Weblogic requires three or five params from the user vi.z weblogic_home or <jdk_home, config_home & pid>, username and... (4 Replies)
Discussion started by: mohtashims
4 Replies
6. Shell Programming and Scripting
Hi,
I need my script to check if the user enters 3 values if not 5 values to my script and alert if the input has any other number of values.
for example:
./myscript.sh 22 56 3221 - > correct
./myscript.sh 22 56 3221 45 777 -> correct
./myscript.sh 22 56 3221 45 -> incorrect
Please... (6 Replies)
Discussion started by: mohtashims
6 Replies
7. Shell Programming and Scripting
Hi
I have one thing I need advice on, and I don't know where to start so I have no sample code.
I want the user to provide input like: 1-3,6,7,9-11
When the input is like this, I want a string to be generated including all the numbers. In the example above, the string would look like:
1... (13 Replies)
Discussion started by: Tobbev
13 Replies
8. UNIX for Dummies Questions & Answers
Hello everybody!!!
I am writing my own rm command in unix.
I prompt the user to type if he wants to delete a file and then read what he typed.
But how do i check what he typed?
This is my program so far:
echo 'Delete prog1.c (y/n)?'
read yesOrNo
if yesOrNo == 'y'
then
rm prog1.c... (6 Replies)
Discussion started by: mskart
6 Replies
9. Shell Programming and Scripting
Hi guys,
Pretty new to regex, and i know im doing something wrong here. I'm trying to get a regex command that restricts a string to be 8 characters long, and the first character cannot be 0. Here's what i have so far...
echo "01234" | grep "^{8}*$"
Thanks very much!
-Crawf
... (7 Replies)
Discussion started by: crawf
7 Replies
10. Shell Programming and Scripting
Bash : how do i check the user input and make sure is only character or only number ? (7 Replies)
Discussion started by: CheeSen
7 Replies