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
NUM=$1 | |
#equel to for (int i=1; i<num; i++) in c/c++, java | |
for i in $(seq 1 $NUM); | |
do | |
echo $i | |
done |
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
if [ -e $DIR1 ] && [ -e $DIR2 ] || [ -e $DIR3 ] | |
then | |
echo "do sth" | |
fi |
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
#delete files or dirs whose name does not end with '.sh' in the current path | |
ls | grep -v '\.sh$' | xargs rm -r | |
#However, this way does not solve the problem that the path names that have spaces, for example, "cmp\ output" | |
#more robust version | |
#from http://stackoverflow.com/questions/4702577/need-a-shell-script-that-deletes-all-files-except-pdf | |
find . -maxdepth 1 -type f ! -iname '*.pdf' -delete | |
#if we need to delete the directories, too, then remove '-type f' |
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
prepare1: | |
if [ ! -e $(LINUX_TAR_NAME) ] ; \ | |
then \ | |
wget $(LINUX_TAR_SITE) ; \ | |
fi; | |
tar -xf $(LINUX_TAR_NAME) && \ |
NewerOlder