放在 bitbucket 上的 repository 裡,以後如果寫些 script 也會丟進裡面( 年輕人就是要玩 HG ! )
script download
#!/bin/bash
# using `tree` to list current directory
# extract current directory name, record time and append to output file
# original: tree -L 3 -I "porn*|tree*" --noreport ./ >> ./tree.txt
LEVEL=3
EXCLUDE_PATTERN="porn*|tree*"
DIRNAME=`basename $PWD`
OUTPUT_FILE="tree.txt"
echo "Using \`tree\` to list contents of \"" $DIRNAME "\" to" $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo "********" >> $OUTPUT_FILE
echo `date` >> $OUTPUT_FILE
echo "********" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
cd ..
tree -L $LEVEL -I "$EXCLUDE_PATTERN" --noreport $DIRNAME >> $DIRNAME/$OUTPUT_FILE
Reference:
tree man page
Four ways to extract the current directory name
沒有留言:
張貼留言