Showing posts with label Shell. Show all posts
Showing posts with label Shell. Show all posts

Wednesday, May 09, 2012

Project: dotfiles : sync dot files


Project : dotfiles

Installation

Creat links for dot files:
./install.sh link
Check links:
./install.sh check
Unlink dot files:
./install.sh unlink
If old files exists then backed up in ${HOME}/*.bak

Source Repo:
git clone https://github.com/guptav/dotfiles.git

Wednesday, April 09, 2008

Duplex printing script

Well,
I don't want to write the same thing again. So please refer to this link to see what this article is about :-).
It is basically about a script for duplex printing.

--Saurabh

Thursday, April 19, 2007

Trapping signals (^C and ^Z) in Bash

#!/bin/bash
#Script written by Vaibhav Gupta
#Trapping HUP TERM INT and ^Z in shell.

echo "Process ID = $$";
stty susp "" #Trapping CTRL-Z
trap 'echo "Trapping CTRL-C, TERM and HUP";' HUP TERM INT
echo

echo "Sleeping for some time"
for i in `seq 1 20`; do
    sleep 1
    echo -n "."
done
echo
stty susp "^Z"


Koool bash Functions


http://www.novell.com/coolsolutions/tools/18639.html

Monday, September 11, 2006

[shell] To find the PPID of a PID and more.

1 #!/bin/bash
2 pid=$1
3 if [ -f "/proc/$pid/stat" ]; then
4 name=`cat /proc/$pid/stat | cut -d" " -f 2`
5 else
6 echo "Not a Valid pid $pid"
7 exit
8 fi
9
10
11 while [ "$pid" -gt "0" ]; do
12 echo -n $pid
13 echo -n [$name]
14 echo -n " --> "
15 name=`cat /proc/$pid/stat | cut -d" " -f 2`
16 pid=`cat /proc/$pid/stat | cut -d" " -f 4`
17 done
18
19 echo "0"
20

-Vaibhav