Results 1 to 8 of 8
would anyone know what is the difference in these two commands?
$ cat xyz[12]
$ cat xyz[1-2]...
- 02-16-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 11
command help
would anyone know what is the difference in these two commands?
$ cat xyz[12]
$ cat xyz[1-2]
- 02-17-2009 #2Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
The results of these two commands (in this case) are identical. You can refer to A Brief Introduction to Regular Expressions for more info.
- 02-17-2009 #3Just Joined!
- Join Date
- Feb 2009
- Posts
- 11
thanks how about these:
$ grep -c ill memo
$ grep -n ill memo
- 02-17-2009 #4Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
man grep
then in the man page, enter
/-c,
for explanation of option c;
then
/-n,
for explanation of option n
- 02-17-2009 #5Just Joined!
- Join Date
- Feb 2009
- Posts
- 11
thanks what about this script - im stuck!
Write a script that will prompt for the user’s first name and store it in a variable. Then prompt for the last name and store it in a variable. Finally, display the stored information in the format “You entered lastname, firstname” and ask the user for confirmation. If the answer is “y” or “yes” then say “Thank you!” if the answer is “n” or “no” then start again with the prompts.
#!/bin/bash
declare FName
read -p "Enter First Name : " FName
declare LName
read -p "Enter Last Name : " LName
echo "you entered" $FName $LName
read -p "Is that correct?"
if [[ $YesNo = "Y,Yes" ]]
then
echo "Thankyou"
else
[[ $YesNo = "N,No" ]]
fi
- 02-17-2009 #6Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
I'm pretty sure there are more than one way to accomplish this, here's one
Code:#!/bin/bash ans='' while [ "$ans" != 'Y' -a "$ans" != "YES" ]; do read -p "Enter First Name: " FName read -p "Enter Last Name: " LName echo "you entered: $FName $LName" read -p "Is that correct? (Y/N)" ans ans=`echo $ans|tr "[:lower:]" "[:upper:]"` case $ans in Y|YES) echo "Thank you $FName $LName." ;; *) echo "Let's try again" ;; esac done
- 02-17-2009 #7Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695

Is this not obviously homework?
2. No religious or political posts, and no homework questions
- 02-17-2009 #8Just Joined!
- Join Date
- Feb 2009
- Posts
- 11
thanks man! its not homework - im taking a course for work -


Reply With Quote