fix: general scripts improvements
append `sed` commands instead of piping them (bibinput, bibshow) add dependencies (bibinput, bibshow) break forloop when bulding is done (compiler)
This commit is contained in:
parent
c329e263f2
commit
97ae8ca1d0
@ -7,16 +7,17 @@
|
|||||||
# @created : Wednesday May 20, 2020 17:57:47 CEST
|
# @created : Wednesday May 20, 2020 17:57:47 CEST
|
||||||
#
|
#
|
||||||
# @description : create a bibliography entry through dmenu
|
# @description : create a bibliography entry through dmenu
|
||||||
|
# @dependencies : dmenu
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
parse(){
|
parse(){
|
||||||
if [ "$1" = "@" ]; then
|
if [ "$1" = "@" ]; then
|
||||||
grep "$1" "$file" | awk -F '{' '{print $2} ' | tr ',' '\n' | sort -r | sed '/^[[:space:]]*$/d'
|
grep "$1" "$file" | awk -F '{' '{print $2} ' | tr ',' '\n' | sed '/^[[:space:]]*$/d' | sort -r
|
||||||
elif [ "$1" = "keywords" ]; then
|
elif [ "$1" = "keywords" ]; then
|
||||||
grep "$1" "$file" | awk -F '"' '{print $2} ' | tr ' ' '\n' | sed 's/,//g' | sort -u | sed '/^[[:space:]]*$/d'
|
grep "$1" "$file" | awk -F '"' '{print $2} ' | tr ' ' '\n' | sed -e 's/,//g' -e '/^[[:space:]]*$/d' | sort -u
|
||||||
else
|
else
|
||||||
grep "$1" "$file" | sed "s/,$//g" | awk -F '"' '{print $2} ' | sort | uniq
|
grep "$1" "$file" | sed "s/,$//g" | awk -F '"' '{print $2} ' | sort -u
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -88,7 +89,7 @@ if [ -z "$keyword" ]; then
|
|||||||
keyword_test="no"
|
keyword_test="no"
|
||||||
else
|
else
|
||||||
keyword_test="$(printf "yes\nno" |dmenu -p "another keyword?")"
|
keyword_test="$(printf "yes\nno" |dmenu -p "another keyword?")"
|
||||||
keyword_test=${keyword_test:-no}
|
keyword_test=${keyword_test:-"no"}
|
||||||
fi
|
fi
|
||||||
while [ "$keyword_test" = "yes" ]; do
|
while [ "$keyword_test" = "yes" ]; do
|
||||||
keyword="$(input "keywords")"
|
keyword="$(input "keywords")"
|
||||||
@ -96,7 +97,7 @@ while [ "$keyword_test" = "yes" ]; do
|
|||||||
keyword_test="no"
|
keyword_test="no"
|
||||||
elif [ "${keywords#*"$keyword"}" != "$keywords" ]; then
|
elif [ "${keywords#*"$keyword"}" != "$keywords" ]; then
|
||||||
keyword_test="$(printf "yes\nno" |dmenu -p "keyword already given. another keyword?")"
|
keyword_test="$(printf "yes\nno" |dmenu -p "keyword already given. another keyword?")"
|
||||||
keyword_test=${keyword_test:-no}
|
keyword_test=${keyword_test:-"no"}
|
||||||
else
|
else
|
||||||
keywords="$keywords, $keyword"
|
keywords="$keywords, $keyword"
|
||||||
keyword_test="$(printf "yes\nno" |dmenu -p "another keyword?")"
|
keyword_test="$(printf "yes\nno" |dmenu -p "another keyword?")"
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
# @created : Wednesday May 20, 2020 17:58:14 CEST
|
# @created : Wednesday May 20, 2020 17:58:14 CEST
|
||||||
#
|
#
|
||||||
# @description : interactively display the infos in a .bib entry
|
# @description : interactively display the infos in a .bib entry
|
||||||
|
# @dependencies : dmenu
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
file="$(find $HOME/documents/bibliographies/ -type f -not -path '*/\.*' | dmenu -l 20 -p "[bibshow] which bibliography?")" # the -not -path allows find to ignore hidden files
|
file="$(find $HOME/documents/bibliographies/ -type f -not -path '*/\.*' | dmenu -l 20 -p "[bibshow] which bibliography?")" # the -not -path allows find to ignore hidden files
|
||||||
|
|
||||||
refs_list="$(sed 's/\t//g' "$file" | tr '\n' ' ' | sed 's/}\ /}\n/g')"
|
refs_list="$(sed -e 's/\t//g' "$file" | tr '\n' ' ' | sed -e 's/}\ /}\n/g')"
|
||||||
[ -z $refs_list ] && exit 1;
|
[ -z $refs_list ] && exit 1;
|
||||||
|
|
||||||
ref="$(echo "$refs_list" | dmenu -i -p 'infos?' -l 10)"
|
ref="$(echo "$refs_list" | dmenu -i -p 'infos?' -l 10)"
|
||||||
|
@ -56,6 +56,7 @@ s_build(){
|
|||||||
for tool in $sucklesstools; do
|
for tool in $sucklesstools; do
|
||||||
if [ "$tool" = "$dirname" ]; then
|
if [ "$tool" = "$dirname" ]; then
|
||||||
s_build
|
s_build
|
||||||
|
break 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user