Feeds:
Posts
Comments

Archive for the ‘Shell Scripts’ Category

With the WA3002G4 wireless router i got recently from my friend i made a wifi hotspot in home. Haven’t been downloading a lot since my script to reboot old teracom router was not working with the new one.Thinking that I should do something on the day which will come only in every four years I modified the old script to work with the new wireless router and I am sharing it here.

#!/usr/bin/env expect

set username admin
set pass admin
set host 192.168.1.1

spawn telnet ${host}

expect -re "Login:"
send "${username}\r"

expect -re "Password:"
send "${pass}\r"

expect -re "Main Menu"
send "13\r"
send "1\r"
expect eof 

Read Full Post »

A slightly edited version of the script to restart router written by Madhusudan.C.S to make it work with teracom router given by bsnl.

#!/usr/bin/env expect

set username admin
set pass admin
set host 192.168.1.1

spawn telnet ${host}

expect -re "Login:"
send "${username}\r"

expect "Password:"
send "${pass}\r"

expect -re "successful"
send "console enable\r"
send "restart\r"
expect eof 

Read Full Post »

Iam back with another shell script written for my sis as part of her assignment. This time what i wanted to do is to count the unique words in a file and to print it in alphabetical order. For that i iterated through the words in the given file using for loop, filtered out the unique words using sort -u and counted it using wc -l.

#!/usr/bin/bash
echo Enter the filename
read fn

for WORD in $(cat $fn)
do
	echo "$WORD"
done | sort -u | wc -l	

 for WORD in $(cat $fn)
 do
  echo "$WORD "
 done | sort -u

Hope this will help someone to do his/her assignment 😀

Read Full Post »

Older Posts »

%d bloggers like this: