Archive for function

[tekwalk] xopen : shell function to have verbose xdg-open : Mac’s “open” alternative for Linux

Posted in AbhishekKr, Blogroll, install-on-linux with tags , , , , , , , on March 4, 2014 by abhishekkr

tekwalk.blogspot.in [13/Feb/2014]

http://tekwalk.blogspot.in/2014/02/xopen-shell-function-to-have-verbose.html

I have been using xdg-open for sometime now, it’s a utility similar to “open” utility popular among MacOSx users.

It enables you to open any file in the default “open with” program assigned to it’s type. So, just passing any type of file to this utility would let you open it in the program it’s supposed to open.

What is xdg-open?
source[1]: https://wiki.archlinux.org/index.php/xdg-open
source[2]: http://linux.die.net/man/1/xdg-open

There is just this little shell function, that makes your xdg-open usage a bit more verbose in case of errors (bad-syntax/ghost-file/ghost-program/open-failure) faced about the reason for it. And also shortens the access util name obviously.

xopen ()
{
xdg-open “$@”;
_TMP_EXITCODE=$?;
if [ “${_TMP_EXITCODE}” == “1” ]; then
echo “[ERROR:] Error in command line syntax”;
else
if [ “${_TMP_EXITCODE}” == “2” ]; then
echo “[ERROR:] One of the files passed on the command line did not exist”;
else
if [ “${_TMP_EXITCODE}” == “3” ]; then
echo “[ERROR:] A required tool could not be found”;
else
if [ “${_TMP_EXITCODE}” == “4” ]; then
echo “[ERROR:] The action failed”;
fi;
fi;
fi;
fi;
return $_TMP_EXITCODE
}

…read full blogpost here

Advertisements

[a.Bionic] shell.function to auto-clone all Repositories from a GitHub account

Posted in Blogroll, tutorial with tags , , , , , , , on April 30, 2013 by abhishekkr

abionic.blogspot.com [13/Jan/2013]

http://abionic.blogspot.in/2013/01/shellfunction-to-download-all.html

a shell utility to download all repositories managed under any GitHub account in the current directory…
if the current directory has any of the repositories already cloned, it pulls the latest

usage:   $ clone-github github
would download all the repositories managed under ‘github’ account

shell function at https://gist.github.com/abhishekkr/4428447/raw/7afb0cc878b6c95d6af37dcdd5e13f62a00befdb/a.github.sh

…click here to read full post

[a.Bionic] download all files embedded from GitHub Gist URL

Posted in ABK Labs with tags , , , , , on December 3, 2012 by abhishekkr

abionic.blogspot.in []

http://abionic.blogspot.in/2012/11/shellfunction-to-download-all-files.html

a shell utility to download all parts of a GIST url at provided download path

usage e.g. $ ddl-gist https://gist.github.com/4165864 /etc/profile.d/

howTo install
$ curl -L -o /etc/profile.d/ddl-gist.sh https://gist.github.com/4165864

actually, if you had this utlity… the usage example would install the utlity… chicken-egg

…..click here to read full post