Created
May 6, 2021 17:51
-
-
Save todd-dsm/53f769165b8e3cb14a625667a85f44c4 to your computer and use it in GitHub Desktop.
conditionally find something in a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
myFile='/tmp/file.yaml' | |
if ! grep thing $myFile; then | |
echo "adding thing!" | |
# code to add thing | |
else | |
echo "thing already exists" # no-op, report only | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment