>> Edit article
이름
제목
패스워드
개인적으로 필요해서 한번 만들어봤는데 혹시 필요하신 분은.. 익스의 export 기능보다 나은 점은 target="_blank"를 추가시켜 줄 수 있다는 것뿐..? #!/bin/sh # 즐겨찾기의 내용을 HTML로 만들어주는 셸스크립트 # : 출력 파일명을 첫번째 인자로 받음 # OPTIONS # target: <a>태그에서 target속성으로 들어가는 부분 # 포함시키지 않으려면, 생략해주면 됨 # bm_path: favorits 폴더의 절대경로 # default_filename: 디폴트 출력 파일명 target="_blank" bm_path="/mnt/c/WINDOWS/Favorites" default_filename="output.html" # 출력 파일의 절대경로를 결정 cur_path=$(pwd) p1=$1 if [ "${p1#/}" != "$p1" ]; then # if start with / output=$p1 elif [ "$p1" = "" ]; then output="${cur_path}/$default_filename" else output="$cur_path/$1" fi # 같은 이름의 디렉토리 혹은 파일이 존재하는지 검사 if [ -d $output ]; then echo "There exists directory of same name!" exit 1 fi if [ -f $output ]; then echo -n "Already existing file name. Overwrite? " read ans case "$ans" in y | Y ) rm -f $output;; * ) exit 1 esac fi # 개별 디렉토리에 대해 *.url 파일들을 검사하는 재귀함수 harvest() { # 공통 부분을 제외한 디렉토리명을 출력 cur_dir=$(pwd) title=${cur_dir#$bm_path} if [ "$title" != "" ]; then echo "directory $* entered" echo >> $output echo "<p><b>${title#/}</b><br>" >> $output fi for file1 in * do if [ "${file1%.url}" != "$file1" ]; then # if ends with .url # *.url 파일들에 대해 검사 # 파일명으로부터 링크 제목을 추출 url="" name=${file1%.url} # 'URL='로 시작하는 행으로부터 url을 추출 for str1 in $(grep URL= "$file1") do if [ "${str1#URL=}" != "$str1" ]; then # if starts with URL= url=${str1#URL=} # echo "NAME: $name" # echo "URL: $url" fi done if [ "$url" != "" ]; then if [ "$target" = "" ]; then echo "<a href="$url">$name</a><br>" >> $output else echo "<a href="$url" target="$target">$name</a><br>" >> $output fi fi fi done # 하위 디렉토리에 대한 재귀호출 for dir in * do if [ -d "$dir" ]; then cd "$dir" harvest "$dir" fi done cd .. } cd "$bm_path" harvest echo "Result saved as $output"
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved