add proper error handling for all final exec calls
[hband-tools.git] / user-tools / palemoon-current-url
blob242fac3c12391fdd67ffb5754986a63f9890f651
1 #!/bin/bash
3 true <<EOF
4 =pod
6 =head1 NAME
8 palemoon-current-url - Display the webpage's URL which is currently open in Palemoon web browser
10 =cut
12 EOF
15 set -e -o pipefail -u
17 sessionstore=`cat "$HOME/.moonchild productions/pale moon"/*.default/sessionstore.js`
18 selectedWindow=`echo "$sessionstore" | jq -r ".selectedWindow"`
19 selectedTab=`echo "$sessionstore" | jq -r ".windows[$((selectedWindow - 1))].selected"`
20 url=`echo "$sessionstore" | jq -r ".windows[$((selectedWindow - 1))].tabs[$((selectedTab - 1))].entries[0].url"`
22 echo "$url"