You don't need a script, just use the 'wc' command:
# Lines
wc -l <file>
# Words
wc -w <file>
You don't need a shell script to do this - just use the 'tail' command.
#!/bin/sh wc -lw "$1"
use python, shell is stupid
You don't need a shell script for that; use either 'whoami' or 'id'
A shell script by itself would be a fairly poor way of doing this; using something like awk or perl with a pattern match for a word would be a much better choice. There are many examples on the net for this type of process using perl, for example.
A shell function will do nothing unless it is explicitly called by other code, typically in a shell script. A shell script is a runnable, executable process, which can call other shell scripts and/or functions. The question might be worded backwards - it is necessary to write shell functions for shell scripts when certain logical functionality is required to be performed multiple times. Consider a shell function equivalent to a program subroutine - they operate the same way.
write ashell script to add awo matrix using array.
#!/bin/sh PS -a
We can not perform Shell Scripting in DOS, we can do Batch programing in DOS..
If the shell script is readable and executable then to execute it just type the name of the shell script file. Otherwise, you can explicity call a shell interpreter to run the file as a shell script, i.e., ksh myfile
You don't need a shell script to do that. Since you don't say what 10 shell variables you want, you can list them all by using the 'set' command to list all known in-use shell variables in the current session.
You don't need a shell script to do this; use the 'grep' command with the '-c' option to count the number of occurrences of some pattern.