Archive

Archive for the ‘Shell Script’ Category

To delete the / after the src From HTML Files

August 5, 2010 1 comment

Deleting the / from the all html file after src=

Deleting the / from the all html files containing in one folder

sed -i ‘s/src=”\//src=”/g’ *.html

Advertisements

To delete the JavaScript Tag in HTML Files

August 4, 2010 Leave a comment

sed -i  ‘/<script type=”text\/javascript”/,/<\/script>/d’  *.html

OR

U can use following code also for same process

#!/bin/bash
# ALL HTML FILES
FILES=”*.html”
# for loop read each file
for f in $FILES
do
INF=”$f”
OUTF=”$f.out.tmp”
# replace javascript
sed ‘/<script type=”text\/javascript”/,/<\/script>/d’ $INF > $OUTF
/bin/cp $OUTF $INF
/bin/rm -f $OUTF
done

Executing Our Own Shell Script When OS Booting in Debian

August 4, 2010 1 comment

Write a shell script.

To Open the folder with super user permission

#! /bin/sh

sudo nautilus

save the file as sample.sh

Make sample file as executable

chmod a+x sample.sh

Copy the file into init.d folder

sudo cp sample.sh /etc/init.d/

check which is default runlevel

sudo vi /etc/inittab

# The default runlevel.
id:2:initdefault:

This means your default run level is 2.

Give the link to to the default run level

ln /etc/init.d/sample.sh /etc/rc2.d/S10sample

why i gave the link rc2.d, because of the default runlevel is 2 so i gave the link to rc2.d.

In S10sample ‘ S ‘ is mandatory 10 is number u can give your own number from 10 to 99

After that update rc by following code

sudo update-rc.d sample defaults

%d bloggers like this: