Bug 765: use load_uri to load the old tab's document to avoid crash
[elinks/miciah.git] / contrib / conv / old_to_new_bookmarks.sh
blob95c0ce4b9eeb277c704c82ade5ac712985da6070
1 #! /bin/sh
2 # ELinks old bookmarks format to new format converter.
4 # WARNING: Close all ELinks sessions before running this script.
5 # This script converts ELinks bookmarks file with '|' as separator to new
6 # bookmarks format where separator is tab char. It saves old file to
7 # ~/.links/bookmarks.with_pipes. --Zas
9 # Script by Stephane Chazelas :)
11 BMFILE=$HOME/.links/bookmarks
12 if [ ! -r "$BMFILE" ]; then
13 echo "$BMFILE does not exist or is not readable!" >&2
14 exit 1
17 if [ -f "${BMFILE}.with_pipes" ]; then
18 echo "It seems you already ran this script." >&2
19 echo "Remove ${BMFILE}.with_pipes to force execution." >&2
20 exit 1
23 if cp -f "$BMFILE" "${BMFILE}.with_pipes" \
24 && tr '|' '\011' < ${BMFILE}.with_pipes > $BMFILE
25 then
26 echo "Bookmarks file converted."
27 echo "Old file was saved as ${BMFILE}.with_pipes."
28 echo "You may want to copy ~/.links/bookmarks to ~/.elinks/bookmarks now."
29 else
30 echo "Conversion failure" >&2
31 exit 1