From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 1088/CH5/EX5.2/Example2.sce | 80 +++++++++++++++++++++++++++++++++++++++++++++ 1088/CH5/EX5.2/Result2.pdf | 65 ++++++++++++++++++++++++++++++++++++ 1088/CH5/EX5.2/Result2.txt | 65 ++++++++++++++++++++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100755 1088/CH5/EX5.2/Example2.sce create mode 100755 1088/CH5/EX5.2/Result2.pdf create mode 100755 1088/CH5/EX5.2/Result2.txt (limited to '1088/CH5/EX5.2') diff --git a/1088/CH5/EX5.2/Example2.sce b/1088/CH5/EX5.2/Example2.sce new file mode 100755 index 000000000..f64a0f142 --- /dev/null +++ b/1088/CH5/EX5.2/Example2.sce @@ -0,0 +1,80 @@ +clear +mode(-1) +flag=1 +pwd +xt=ans +flag=1 +clc + +printf("Example 2 : Show the method of copying files in unix using the cp command \n") +disp("****************************************************************") +disp("Answer : ") +disp("INSTRUCTIONS : ") +printf("\nHere all instructions are preloaded in the form of a demo\nPRESS ENTER AFTER EACH COMMAND to see its RESULT\nPRESS ENTER AFTER EACH RESULT TO GO TO THE NEXT COMMAND\n") +halt('.............Press [ENTER] to continue.....') +halt("") +clc +printf("\tUNIX SHELL SIMULATOR(DEMO VERSION WITH PRELOADED COMMANDS)\n\n\n") + +src=input("# Enter the name of the file[or directory] which you want to copy : ",'s') +if isdir(src) then +destn=input("# Enter the name of the directory which you want to copy into : ",'s') +else + destn=input("# Enter the name of the file[or directory] which you want to copy into : ",'s') +end + +flag=0 +printf("\n $ cp %s %s \t#copies file[or directory] contents of %s to %s\n",src,destn,src,destn) +halt('') + + +if isfile(destn)&isfile(src) then + printf('cp : overwrite %s (yes/no)? ',destn) + resp=input(' ','s') + if resp=='y' then + mdelete(destn) + end +end + +if isfile(src)|isdir(src) then + flag=1 + [status,msg]=copyfile(src,destn) +else + printf("\n%s : file or directory not found \n",src) + flag=0 +end + +if flag==1&isfile(destn) then + i=1 + printf("\n $ cat %s \t#to display the copied file %s \n\n",destn,destn) + printf("\n ===========> %s <============\n\n\n",destn) + fhdr=mopen(destn,'rt') + while %t + [n,a]=mfscanf(fhdr,"%c") + if meof(fhdr) then + break + end + printf("%c",a) + i=i+1 + end + mclose(fhdr) + printf("\n\n%d characters present in the file.\n[hit ENTER to continue]\n",i) + halt('') + elseif isdir(destn)&flag==1 then + cd(destn) + mode(0) + ls + halt("Go back to previous directory ?? ") + mode(-1) + cd(xt) +else + printf("\n\n# file %s is not rewritten using copy command cp and not created also\n",destn) +end + + +printf("\n\n\n$ exit #To exit the current simulation terminal and return to Scilab console\n\n") +halt("........# (hit [ENTER] for result)") +//clc() + +printf("\n\n\t\t\tBACK TO SCILAB CONSOLE...\nLoading initial environment') +sleep(1000) diff --git a/1088/CH5/EX5.2/Result2.pdf b/1088/CH5/EX5.2/Result2.pdf new file mode 100755 index 000000000..ed21f7fec --- /dev/null +++ b/1088/CH5/EX5.2/Result2.pdf @@ -0,0 +1,65 @@ + ans = + + 1. + +-->exec("Example2.sci",-1) +Current date is 05-Jun-2013 + +Welcome to the Textbook Companionship Project 2013 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Book Title : UNIX CONCEPTS AND APPLICATIONS + + Book Edition : 4 + + Book Author : Sumitabha Das ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Code Author : Pranav Bhat T ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Chapter Number : 5 + + Chapter Title : HANDLING ORDINARY FILES ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +Example 2 : Show the method of copying files in unix using the cp command + + **************************************************************** + + Answer : + + INSTRUCTIONS : + +Here all instructions are preloaded in the form of a demo +PRESS ENTER AFTER EACH COMMAND to see its RESULT +PRESS ENTER AFTER EACH RESULT TO GO TO THE NEXT COMMAND +.............Press [ENTER] to continue..... UNIX SHELL SIMULATOR(DEMO VERSION WITH PRELOADED COMMANDS) + + + + $ cp hither hithere #copies file[or directory] contents of hither to hithere + + $ cat hithere #to display the copied file hithere + + + ===========> hithere <============ + + +Hi I am Pranav +I am an intern at FOSSE project +I hope this project helps students well +Thank You + + +98 characters present in the file. +[hit ENTER to continue] + + + +$ exit #To exit the current simulation terminal and return to Scilab console + +........# (hit [ENTER] for result) + + BACK TO SCILAB CONSOLE... +Loading initial environment +-->diary(0) diff --git a/1088/CH5/EX5.2/Result2.txt b/1088/CH5/EX5.2/Result2.txt new file mode 100755 index 000000000..ed21f7fec --- /dev/null +++ b/1088/CH5/EX5.2/Result2.txt @@ -0,0 +1,65 @@ + ans = + + 1. + +-->exec("Example2.sci",-1) +Current date is 05-Jun-2013 + +Welcome to the Textbook Companionship Project 2013 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Book Title : UNIX CONCEPTS AND APPLICATIONS + + Book Edition : 4 + + Book Author : Sumitabha Das ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Code Author : Pranav Bhat T ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Chapter Number : 5 + + Chapter Title : HANDLING ORDINARY FILES ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +Example 2 : Show the method of copying files in unix using the cp command + + **************************************************************** + + Answer : + + INSTRUCTIONS : + +Here all instructions are preloaded in the form of a demo +PRESS ENTER AFTER EACH COMMAND to see its RESULT +PRESS ENTER AFTER EACH RESULT TO GO TO THE NEXT COMMAND +.............Press [ENTER] to continue..... UNIX SHELL SIMULATOR(DEMO VERSION WITH PRELOADED COMMANDS) + + + + $ cp hither hithere #copies file[or directory] contents of hither to hithere + + $ cat hithere #to display the copied file hithere + + + ===========> hithere <============ + + +Hi I am Pranav +I am an intern at FOSSE project +I hope this project helps students well +Thank You + + +98 characters present in the file. +[hit ENTER to continue] + + + +$ exit #To exit the current simulation terminal and return to Scilab console + +........# (hit [ENTER] for result) + + BACK TO SCILAB CONSOLE... +Loading initial environment +-->diary(0) -- cgit