Search Results

Search: Posts Made By: bludhemn
2,404
Posted By agama
You'll need to change things a wee bit. ...
You'll need to change things a wee bit.

First, I think, you'll need egrep if you are going to use 'pattern|pattern'. At least my version of grep won't do this, but egrep will.

Second, your...
2,404
Posted By yazu
Try: if grep -wq "$D" testfile then echo $D...
Try:
if grep -wq "$D" testfile
then
echo $D exists
else
echo $D doesnt exist
fi
2,404
Posted By agama
Try something like this: if grep -q "$D"...
Try something like this:


if grep -q "$D" testfile
then
echo "there"
else
echo "not there"
fi


You don't need to cat to grep; grep will read the file. You also don't want to test...
1,012
Posted By neutronscott
the single-quotations don't allow for expansion....
the single-quotations don't allow for expansion. but then you also need in-place editing:

sed -i "/$USER/d" /etc/sudoers

or better

sed -i.bak

so that it saves the backup
3,769
Posted By SteveDawe
Try this line instead as the --md5 is being...
Try this line instead as the --md5 is being mistaken for a command line and the quotes may help too.

if grep -Fxq -- "$GRUBPASSWD" /etc/grub.conf
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 09:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy