Skip to content

Instantly share code, notes, and snippets.

Junji Zhi junjizhi

Block or report user

Report or block junjizhi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
junjizhi /
Created Dec 15, 2013
Multiple conditions in the shell. if condition
if [ -e $DIR1 ] && [ -e $DIR2 ] || [ -e $DIR3 ]
echo "do sth"
junjizhi /
Created Dec 15, 2013
delete file not ending with a certain format
#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
find . -maxdepth 1 -type f ! -iname '*.pdf' -delete
#if we need to delete the directories, too, then remove '-type f'
junjizhi / download_kernel_if_not_exist.makefile
Created Dec 12, 2013
Makefile: how to write conditional in the target implementation script
View download_kernel_if_not_exist.makefile
if [ ! -e $(LINUX_TAR_NAME) ] ; \
then \
wget $(LINUX_TAR_SITE) ; \
tar -xf $(LINUX_TAR_NAME) && \
You can’t perform that action at this time.