Tuesday, August 24, 2010

Scripting Tutorials

SHELL SCRIPTING:

* sHELL: it is an interface between user and OS.
bash is a character based sell interface, these interfaces accepts lines f textul command
that the user type in.

* For sorting a file

sort -n filname >> filname.txt
This will save the sorted out put of filename to filename.txt

* UNIX is one of the first operating systems to make the user interface independent
of the operating system.

** Bourne shell, K shell,

* To install bash as your login shell, type chsh bash-name, where bash-name
is the response you got to your whereis command (or whatever worked).
For example:% chsh /usr/local/bin/bash

* lp ==command used for printing

* WILD CARDS:

? == ANY SIGNLE CHARACTER
* == aNY STRING OF CHARACTER
[set] == any characher in set

Brace []:

b{ar{d,n,k},ed}s. == >> out puts bards,barns,barks,beds


** cat < file1 > file2 This similaer tp cp file1 file2

** CUT command:

grep usernames from /etc/passwd file

cat /etc/passwd | cut -d: -f1 >> test1


** To print natural numbers:

for i in `seq 1 10`;do echo $i;done;


ECHO:

echo string ==>> o/put as string
echo 'string' ==>> o/put as string
echo "string" ==>> o/put as string

echo 2 * 2 > 3 == o/put as a file with name 3 and containing all the file names in the
current directory including 2.

echo '2 * 2 > 3' == >> o/put as 2 * 2 > 3

echo " 2 * 2 > 3 " == >> o/put as 2 * 2 > 3


Most popular unix editors:
vi and emacs

No comments:

Post a Comment