Books menu with bash

2020-08-16 158 words 1 min read

If you have a folder full of ebooks in various formats and not necessarily one sigle format and you want to have a quick menu to browse though your collection without requiring to open a File Manager then you are going to love this script.

The scripts works by allowing you to browse to the requied folder of your choice and once you select the file, then using xdg-open to open the file with your default viewer.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

path=/Books
cd $path
doc=$(zenity --list --text="Select File" --column=Filename * '..')
while [[ -d "$doc" ]]
do
    doc1=$(cd "$doc";zenity --list --text="Select Something" --column=Filename  * '..')
    [[ ! -n "$doc1" ]] && exit
    doc="$doc/$doc1";
done
if [[ -f "$doc" ]]
then
    echo "Selected $doc.. Opening"
    xdg-open "$doc"
fi

Note you need to change the path variable in the script to your path.

Hope this is useful for you.


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it