Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Shell Scripts to print the files present in one directory but not present in other directory
# cmp_dir - program to compare two directories and print the files # which are present in first directory but not in second directory # ...
Posted by Admin on
Scripts to check,String checks operator and techniques
#String checks operator and techniques str1="ishant" str2="gaurav" str3="" # to check if two string are equal...
Posted by Admin on
Scripts to find one file and append data to it
#This scripts find one file in current directory and append data to it if [ -f $1 ] then if [ -w $1 ] # -w option is used to write...
Posted by Admin on
Script to find if file exist, then change its name
#This scripts find one file in current directory and changes its name if [ -f $1 ] then mv $1 $2 echo "File name has been changed,Let...
Posted by Admin on
Script to print the last modification time of file if exists
Write a script that accepts a file name as arguments and display the last modification time if the file exists and a suitable message if it...
Posted by Admin on
"grep" command interview Questions
We have three files in our current directory as below : Newfile.txt This is ishant gaurav I love to play cricket I am bit confused no...
Posted by Admin on
Unix Commands Interview Question Set1
Que :What is the output of this command? $who | sort –logfile > newfile Ans : In this command, the output from the command “who” beco...
Posted by Admin on
Shell Script to add the digits of a number
Write script to print given numbers sum of all digit, For eg. If no is 123 it's sum of all digit will be 1+2+3 = 6. #!/bin/ksh n=12...
Posted by Admin on
Shell Script to reverse given no
Write script to print given number in reverse order, for eg. If no is 123 it must print as 321. #!/bin/ksh n=123 num=0 while [ n -gt...
Posted by Admin on
Shell Script to find the greatest of three number provided as command line arguments
Write Script to find out biggest number from given three nos. Nos are supplies as command line argument. Print error if sufficient argument...
Posted by Admin on
Basic Linux Commands
Pwd: pwd command will print your home directory on screen, pwd means print working directory. /u0/ssb/ishant is output for the command ...
Posted by Admin on
Subscribe to:
Posts (Atom)