Open main menu

CDOT Wiki β

Changes

User:Minooz/RepoSyncProj/Bash

82 bytes added, 15:02, 18 October 2010
Tips
* to check if a file exists: (when using wild cards, if you don't use double quotes, there will be this error: "binary operator expected")
<source lang=bash>
if [ -f "*m.patch" ]; then
rm *.patch
fi
</source>
 
 
* To check if multiple files exist:
<source lang=bash>
files=$(ls /tmp/*.cache)
if [ $files ]
then
echo "Cache files exist: do something with them"
else
echo "No cache files..."
fi
</source>
1
edit