LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

Pseudo-template noob hack that may apply for several situations

Posted 04-12-2012 at 04:10 PM by the dsc (linux-related notes)
Updated 04-12-2012 at 04:14 PM by the dsc

There's a painting software, "mypaint", which is very nice, but it does not support templates, at least not yet.

I've created a template (just a "blank" file with the correct resolution and whatnot) on GIMP, saved it as "ora", but instead of opening this file manually every time, and remembering to save it with a new name in order to not overwrite the template, I came up with a script that will create a new name automatically, with no risk of overwriting...
Member
Posted in Uncategorized
Views 5702 Comments 2 the dsc is offline
Old

Bash functions to list and kill or send signals to process trees

Posted 03-31-2012 at 11:54 PM by konsolebox
Updated 04-11-2013 at 07:47 PM by konsolebox

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.

killtree - Creates a list of processes based from a parent process ID first then sends the signal to all of them synchronously.

killtree2 - Same as killtree but it doesn't create a list first. It immediately kills processes as it goes through every level.

killtree3 - This version kills...
Senior Member
Posted in Howtos
Views 1367 Comments 0 konsolebox is offline
Old

Comment a block in shell

Posted 08-31-2011 at 12:22 AM by hi2arun
Tags bash, script

We all know, to comment out a line in shell script, '#' token is inserted in the line that needs to be made dead.
Eg:

Code:
# This is a dead line
echo "This line is live"
However, '#' token can be pesky if a block of lines need to be commented out.
Say, to comment out the following block using '#'

Code:
# comment starts here
# All these lines
# are blocked
# using '#' token
# ...
# ...
# ...
...
Member
Posted in Uncategorized
Views 753 Comments 0 hi2arun is offline
Old

Getting Absolute Paths of UNIX Directories and Filenames in Shell Scripts

Posted 07-08-2011 at 03:05 AM by konsolebox
Updated 07-17-2011 at 09:11 AM by konsolebox
Tags bash, ksh, script, shell, zsh

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 (3.0 and newer only)
Code:
function getabspath {
	local -a T1 T2
	local -i I=0
	local IFS=/ A

	case "$1" in
	/*)
		read -r -a T1 <<< "$1"
		;;
	*)
		read
...
Senior Member
Posted in Howtos
Views 1613 Comments 0 konsolebox is offline
Old

Shortest command to calculate the sum of a column of output

Posted 06-02-2010 at 06:27 AM by bittner (Notes on Linux)

I had to calculate the Installed-Size for a .deb control file recently. Here is the solution I came up with:

Code:
dpkg-deb -c mypackage.deb | sed -e 's/.*root\s*//' -e 's/\s*2010-.*$//' | xargs | tr ' ' + | bc
What it does? The code tries to construct a calculation string and feeds it to the command line calculator bc as follows:
  1. use dpkg-deb to get the file size information out of the Debian package
  2. sed away all characters before and after the
...
LQ Newbie
Posted in Uncategorized
Views 3989 Comments 2 bittner is offline

  



All times are GMT -5. The time now is 12:02 AM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration