У меня есть эта программа в GitHub. Используется для перехода в каталоги через настраиваемые теги. Вот основной сценарий bash:
out_file=$(mktemp)
~/.ds/ds_engine $@ > $out_file
command_type=$(head -n 1 $out_file)
if [ $# -eq 0 ]; then
next_path=$(tail -n 1 $out_file)
~/.ds/ds_engine --update-previous $(pwd)
cd $next_path
else
if [ "$command_type" == "switch_directory" ]; then
next_path=$(tail -n 1 $out_file)
if [ ! -d "$next_path" ]; then
echo 2> "Directory "$next_path" does not exist."
exit 1
fi
~/.ds/ds_engine --update-previous $(pwd)
cd $next_path
elif [ "$command_type" == "show_tag_entry_list" ]; then
tail -n +2 $out_file
else
echo "Unknown command: $command_type"
fi
fi
rm $out_file
Смотрите также
- Скрипт установщика
- Движок тегов
Запрос на критику
Пожалуйста, расскажите мне все, что придет в голову. ^^