Unix Blog

echo \"Enter string \"
read str
len=\`echo $str | wc -c\`
if [ $len -le 10 ]
    echo \"LEss then 10\"
    echo \"More than 10\"

echo \"Length of string is \" $len

    Related Post:
  1. Write a shell script to find sum of digits of a number

  2. Append abc.txt, xyz .txt

  3. Shell Script to read data from a file

  4. Shell script to print first 5 odd numbers

  5. How would you display the calendar of 2007?

  6. Split a large file into small files

  7. How to find out difference between two files?

  8. Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal)

  9. Shell script to perform string replacement in a file and view the content of file

  10. write a script to delete zero sized files from a given directory (and all its subdirectories)

  11. Rename a file from first1.txt to first2.txt

  12. Write a menu driven shell script for Copy a file, Remove a file, Move a file

  13. Is it possible to create and remover more than one directory together?

  14. Write a shell script for renaming each files in the directory such that it will have the current shell PID as an extension

  15. Write a shell script, which will receive any number of filenames as arguments .The shell script should check whether such files already exist.

  16. Shell script to check dir directory if it exists then change the path, if not then create dir with that name and also check for file name not exists

  17. Write a shell program to find the sum of the series sum=1+1/2+...+1/n

  18. Shell script to display the name of those files (in the given directory) which are having multiple links

  19. Shell script which receives two file names as arguments and checks whether the two file contents are same or not. If same then delete second file

  20. Write a shell program to convert all the contents into the uppercase in a particular file

Didn't find what you were looking for? Find more on Program to count length of user input string