Last active
December 15, 2023 11:43
-
-
Save arnoldc/bf88869799ea8703be642ff63735245a to your computer and use it in GitHub Desktop.
[Bashscript] General Tips
This file contains 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
1. Command to add to recognize the file type | |
#!/bin/bash | |
use .sh extension | |
######################################## | |
2. To test if file exists | |
test -e random-file.pdf && echo "EXISTS" || echo "NOT EXISTS" | |
outputs: | |
EXISTS | |
######################################## | |
3. To see if library is installed | |
comand -v node | |
outputs: | |
/usr/local/bin/node | |
######################################## | |
4. if else syntax | |
if command -v node; then | |
echo "node is installed" | |
else | |
echo "node is not installed" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment