Write a shell script to create two directories and store five files in one directory using the related commands and to transfer all the files to another directory.

clear
echo "Current Directory is"
pwd
echo
echo
echo "Create Subdirectory"
echo "Enter two subdirectory names"
read name name1
mkdir $name $name1
echo
echo
echo "Move to subdirectory $name"
cd $name
echo
echo
echo "Current directory is `pwd`"
echo "Create five files"
echo "Enter file name "
read file1 file2 file3 file4 file5
touch $file1 $file2 $file3 $file4 $file5
echo "Contents of current directory"
ls
echo
echo
echo "Move files from $name to $name1"
mv $file1 $file2 $file3 $file4 $file5 /home/shaan51/$name1
echo "Files are moved to $name1 directory"
echo
echo
echo "Change to directory location to subdirectory $name1"
cd ..
cd $name1
echo "Current directory is `pwd`"
echo
echo
echo "Display contents of $name1 "
ls


OutPut


Current Directory is
/home/shaan51


Create Subdirectory
Enter two subdirectory names
st12 st13


Move to subdirectory st12


Current directory is /home/shaan51/st12
Create five files
Enter file name
h1 h2 h3 h4 h5
Contents of current directory
h1  h2    h3  h4    h5


Move files from st12 to st13
Files are moved to st13 directory


Change to directory location to subdirectory st13
Current directory is /home/shaan51/st13


Display contents of st13
h1  h2    h3  h4    h5

1 comment:

  1. We are urgently in need of KlDNEY donors for the sum of $500,000.00 USD, Email for more details:
    hospitalcarecenter@gmail.com
    WhatsApp +91 779-583-3215

    ReplyDelete