Answers for "check file for string bash"

1

bash check for file

if test -f /bin/ls
then
  echo "exists"
fi
Posted by: Guest on May-24-2021
1

bash check if string 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
Posted by: Guest on November-11-2020

Code answers related to "check file for string bash"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language