Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
These functions can be used in scripts or interactive shells to manipulate process trees. At least bash version 3.0 is needed. May also work with some earlier versions.
kill_tree - Creates a list of processes based from a parent process ID first then sends the signal to all of them synchronously.
kill_tree_2 - Same as killtree but it doesn't create a list first. It immediately kills processes as it goes through every level.
This post is a compilation of the function getabspath() for different shells that can be used to get the absolute form of a path. The function accepts an argument path then returns the absolute form of it to the variable $__.
Bash
Code:
function getabspath {
local t=() i=0 IFS=/
case $1 in
/*)
__=${1#/}
;;
*)
__=${PWD#/}/$1
;;
esac
case $- in
*f*)
set -- $__
Posted 04-09-2011 at 04:09 AM bykonsolebox Updated 07-08-2011 at 02:50 AM bykonsolebox
After almost 2 years of trying to perfect and refine this software, it's now finally reached the first presentable and stable form. Maybe it's already the final form I'm not sure. I'm glad that I was able to finish it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.