echo "Please enter a forum"; Forum; if [ ! $ Foreman]; Then echo "$ Forename not found"; Else grep -n "Forename: $ Forename" $ filename | type;
i
I am trying to use the above code to check that the user entering the string in the file exists, the file name is < Code> Address Book Txt which I assigned to the variable filename
.
Can someone advise me whether this will work or recommend a better way of checking the file. You can print the contents of the file by using the cat for example:
You can now check that the string content
is empty:
if [- N "$ Content"]; Then you can use the grep
Code> content = $ (grep "$ pattern" "$ filename")
and if it will be the same
No comments:
Post a Comment