OS-Lab-1
OS-Lab-1
Important Commands
1. To go to the previous directory cd ..
2. To check the content of the directory ls
3. To remove the directory:
a. First check whether the directory is empty or not, if it is empty type
rmdir directoryname
b. If the directory is not empty follow the following steps:
i. cd directoryname
ii. rm filename.sh
c. Then type rmdir directoryname
1st Week
grep–used to search a particular word or pattern related to that word from the file.
rm–deletes a file from the file system
wc–it counts the number of lines, words, character in a specified file(s) with the options
as –l,-w,-c
wc –l filename
wc –w filename
wc –c filename
cp–copies the files or directories
cp source_file destination_file
#!/bin/bash
# Shell Script Program to concatenate two strings
echo "Enter the two strings to be concatenated: "
read str1
read str2
res=$str1$str2 #Spaces are not considered, therefore use underscore to denote space
echo "The resultant string is: "
echo $res
ii. Comparison of two strings:
#!/bin/bash
string1="Hello"
string2="Hello"
if [ "$string1" == "$string2" ]
then
echo "The two strings are equal"
fi