if grep -q SomeString "$File"; then
Some Actions # SomeString was found
fi
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
Code Example |
---|
Shell :: shell script variable |
Shell :: install cocoapi |
Shell :: git push url change |
Shell :: git squash commits merge |
Shell :: git rm --cached |
Shell :: docker container with powershell |
Shell :: linux change file name |
Shell :: current time linux |
Shell :: matplotlib log colorbar |
Shell :: build docker file with no cache |
Shell :: composer for windows |
Shell :: gitbash update |
Shell :: install neovim |
Shell :: how to zip and unzip tar |
Shell :: how to reset ubuntu 20.04 |
Shell :: git remember login |
Shell :: linux ssh server |
Shell :: vijm jump to end of file |
Shell :: dhcp release mac os |
Shell :: $$ in shell script |
Shell :: how to install android studio in ubuntu |
Shell :: get history command without line numbers |
Shell :: linux kill process |
Shell :: sourcetree permission denied (publickey) github mac |
Shell :: docker delete image |
Shell :: gui for ubuntu server |
Shell :: mono-complete arch |
Shell :: github oauth 2 |
Shell :: unity download android sdk |
Shell :: linux unpack .tar |