Girish Venkatachalam <girishvenkatachalam@...> writes:

> 
> We cannot do sockets programming with shell script since sockets
> require a networking
>  library and shells do not have any libraries. But we can obviously
> invoke netcat and
> socat or any other software using shell scripts but we cannot do low
> level socket
> operations with shell scripts. Low level operations like closing
> sockets, accepting a socket,
>  reading and writing a certain number of bytes etc. can't be done.

We can do socket programming in bash but yes we cannot do fine grained control 
like C in bash. This article says a way to do socket programming in bash 
http://thesmithfam.org/blog/2006/05/23/bash-socket-programming-with-devtcp-2/

> 
> In fact even higher level scripting languages do not permit much control.
> 
> But shell scripts are very powerful for many common applications like
> say simple counters.
> 
> In OpenBSD I use jot. In Linux you use something like rs or seq.
> 
> $ cat s.sh
> for s in `jot 100 1 100`
> do
>         print $s
> done
> 
> This will print a sequence of numbers from 1 to 100. One each line.
> 

I am not familiar with jot. But if it is just printing 1 to 100 in one line 
each 
, you could do it the bash way , like
$ cat i.sh
for i in {1..100}
do
echo $i
done

--ashwin

_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to