Horje
linux test if string exists in file Code Example
linux test if string exists in file
if grep -Fxq "string" file.txt; then 
	echo "Match"
else 
	echo "No match"
fi
bash check if string does not exist in file
Just use grep with flags 'F' (fixed string), 'x' (exact match) and 'q'
(quiet output) in order to check if a word string is in a file
if ! grep -Fxq "string" file.txt; then #do some code...#; fi




Shell

Related
turn on bluetooth terminal linux Code Example turn on bluetooth terminal linux Code Example
ip on mac Code Example ip on mac Code Example
install pygame on mac Code Example install pygame on mac Code Example
how to add exclusion to windows defender command line Code Example how to add exclusion to windows defender command line Code Example
git eliminar rama local Code Example git eliminar rama local Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13