• Welcome to Bashguru

    Linux is one of popular version of UNIX operating System. It is open source as its source code is freely available. It is free to use. Linux was designed considering UNIX compatibility. It's functionality list is quite similar to that of UNIX and become very popular over the last several years. Our Basic motive is to provide latest information about Linux Operating system.

  • Python Programming

    Python is a comparatively simple programming language, compared to c++. Although some of the benefits of c++ are abstracted away in python, they are replaced with an overall easier to learn language with many “intuitive” features. For this reason it is common and recommended by most professionals that people new to programming start with python.

  • Perl Programming

    Perl is an open-source, general-purpose interpreted programming language. Used often for CGI, Perl is also used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications. The Perl languages borrow features from other programming languages including C, shell scripting (sh), AWK, and sed. They provide powerful text processing facilities without the arbitrary data-length limits of many contemporary UNIX command line tools, facilitating easy manipulation of text files.

  • Android

    Android is an operating system based on the Linux kernel, and designed primarily for touch screen mobile devices such as smart phones and tablet computers. Android is a Linux-based software system, and similar to Linux, is free and open source software. This means that other companies can use the Android operating developed by Google and use it in their mobile devices.Android gives you a world-class platform for creating apps and games for Android users everywhere, as well as an open marketplace for distributing to them instantly.

Friday, April 25, 2008

Posted by venu k
14 comments | 10:02 PM

Small Chess Board


#!/bin/bash
# SCRIPT : smallchessboard.sh
# PURPOSE : Prints small chess board on the screen.

clear
for (( i=1 ; i<=8 ; i++ ))
do

for (( j=1 ; j<=8 ; j++ ))
do

if [ `expr $(($i+$j)) % 2` -eq 0 ]
then
echo -e -n "\033[47m " # White background
else
echo -e -n "\033[40m " # Black background
fi

done
echo # move to next line

done

echo -e "\033[0m" # Restores color settings.


OUTPUT:


Big Chess Board


#!/bin/bash
# SCRIPT : bigchessboard.sh
# PURPOSE : Prints big chess board on the screen.

clear
a=4

for (( i=1 ; i<=8; i++ ))
do

for (( j=1 ;j<=2; j++ )) # prints same line twice
do
tput cup $a 15 # moves cursor to LINE COLUMN

for (( k=1 ; k<=8; k++ ))
do

c=`expr $((i+k)) % 2`

if [ $c -eq 0 ]
then
echo -e -n "\033[40m " # Black background
else
echo -e -n "\033[47m " # White background
fi

done
let a=a+1

done

done

echo -e "\033[0m" # Restores color settings
read key # Waits for enter


OUTPUT:


Tuesday, April 1, 2008

Posted by venu k
3 comments | 10:51 PM
  1. time head -5 emp.lst tail -1
    It has taken time for execution is
    real 0m0.004s
    user 0m0.001s
    sys 0m0.001s
    or
  2. awk 'NR==5' emp.lst
    It has taken time for execution is
    real 0m0.003s
    user 0m0.000s
    sys 0m0.002s
    or
  3. sed -n '5p' emp.lst
    It has taken time for execution is
    real 0m0.001s
    user 0m0.000s
    sys 0m0.001s
    or
  4. using some cute trick we can get this with cut command
    cut -d “
    “ -f 5 emp.lst
    # after -d press enter ,it means delimiter is newline
    It has taken time for execution is
    real 0m0.001s
    user 0m0.000s
    sys 0m0.001s

    Analysis: comparing above commands 'head' command taken maximum time
    because it pipes the output to tail command. piping consumes some
    time.
    Next “awk” command has taken greater time ,because 'awk' not only
    a command, it is a programing language too.
Posted by venu k
6 comments | 1:50 AM
· Resource-intensive tasks, especially where speed is a factor (sorting, hashing,
etc.)Procedures involving heavy-duty math operations, especially floating
point arithmetic, arbitraryprecision calculations, or complex numbers
(use C++ or FORTRAN instead)

· Cross-platform portability required (use C or Java instead) Complex applications, where structured programming is a necessity (need type-checking of variables, function prototypes, etc.)

· Project consists of subcomponents with interlocking dependencies Extensive file operations required (Bash is limited to serial file access, and that only in a particularly clumsy and inefficient line-by-line fashion)

· Need native support for multi-dimensional arrays
· Need data structures, such as linked lists or trees
· Need to generate or manipulate graphics or GUIs
· Need direct access to system hardware
· Need port or socket I/O
· Need to use libraries or interface with legacy code