#!/bin/bash
#                       /usr/local/bin/debsrc
#  http://crystalfaeries.net/posix/bin/debsrc
# celeste:crystalfaery 2016-02-19 08:55:05+00:00
# https://matthieu.io/blog/2015/08/16/one-liner-to-catch-em-all/

function debsrc {
    readlink -f $1 | xargs dpkg-query --search | awk -F ": " '{print $1}' | xargs apt-cache showsrc | grep-dctrl -s 'Package' -n '' | awk -F " " '{print "http://sources.debian.net/src/"$1"/latest/"}' | xargs x-www-browser
}

CMD="$1"
debsrc ${CMD}



syntax highlighted by Code2HTML, v. 0.9.1