Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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
Comment

PREVIOUS NEXT
Code Example
Shell :: aws secrets manager get password 
Shell :: linux os update 
Shell :: command to return to old shell 
Shell :: cli50 documentation 
Shell :: shallow clone specific branch 
Shell :: regex in batch file 
Shell :: install apk as system app with adb 
Shell :: pushing an existing repository from cmd 
Shell :: ubuntu install safari browser terminal 
Shell :: run appimage apps on arch linux 
Shell :: step6 pgadmin ubuntu 20.04 
Shell :: interact with docker container shell 
Shell :: printf in bash 
Shell :: xargs 
Shell :: add ssh key to github 
Shell :: bash read options from file 
Shell :: git push http access denied 
Shell :: pwa install 
Shell :: npm warn 
Shell :: docker run commands 
Shell :: terminal archive files 
Shell :: set alias for directory in powershell 
Shell :: jinja escape 
Shell :: Enable-Migrations 
Shell :: chrome extension to safari extension 
Shell :: permission denied 
Shell :: jenkinsfile run curl in a function 
Shell :: kubernetes get persistent volume claims 
Shell :: terraform element function 
Shell :: hide permission denied ~/.bash 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =