diff options
Diffstat (limited to '1088/CH5')
-rwxr-xr-x | 1088/CH5/EX5.1/Example1.sce | 71 | ||||
-rwxr-xr-x | 1088/CH5/EX5.1/Result1.pdf | 76 | ||||
-rwxr-xr-x | 1088/CH5/EX5.1/Result1.txt | 76 | ||||
-rwxr-xr-x | 1088/CH5/EX5.2/Example2.sce | 80 | ||||
-rwxr-xr-x | 1088/CH5/EX5.2/Result2.pdf | 65 | ||||
-rwxr-xr-x | 1088/CH5/EX5.2/Result2.txt | 65 | ||||
-rwxr-xr-x | 1088/CH5/EX5.3/Example3.sce | 63 | ||||
-rwxr-xr-x | 1088/CH5/EX5.3/Result3.pdf | 54 | ||||
-rwxr-xr-x | 1088/CH5/EX5.3/Result3.txt | 54 | ||||
-rwxr-xr-x | 1088/CH5/EX5.4/Example4.sce | 79 | ||||
-rwxr-xr-x | 1088/CH5/EX5.4/Result4.pdf | 65 | ||||
-rwxr-xr-x | 1088/CH5/EX5.4/Result4.txt | 65 | ||||
-rwxr-xr-x | 1088/CH5/EX5.5/Example5.sce | 58 | ||||
-rwxr-xr-x | 1088/CH5/EX5.5/Result5.pdf | 53 | ||||
-rwxr-xr-x | 1088/CH5/EX5.5/Result5.txt | 53 | ||||
-rwxr-xr-x | 1088/CH5/EX5.6/Example6.sce | 94 | ||||
-rwxr-xr-x | 1088/CH5/EX5.6/Result6.pdf | 84 | ||||
-rwxr-xr-x | 1088/CH5/EX5.6/Result6.txt | 84 | ||||
-rwxr-xr-x | 1088/CH5/EX5.7/Example7.sce | 104 | ||||
-rwxr-xr-x | 1088/CH5/EX5.7/Result7.pdf | 91 | ||||
-rwxr-xr-x | 1088/CH5/EX5.7/Result7.txt | 91 | ||||
-rwxr-xr-x | 1088/CH5/EX5.8/Example8.sce | 85 | ||||
-rwxr-xr-x | 1088/CH5/EX5.8/Result8.pdf | 195 | ||||
-rwxr-xr-x | 1088/CH5/EX5.8/Result8.txt | 195 |
24 files changed, 2000 insertions, 0 deletions
diff --git a/1088/CH5/EX5.1/Example1.sce b/1088/CH5/EX5.1/Example1.sce new file mode 100755 index 000000000..e288f05b6 --- /dev/null +++ b/1088/CH5/EX5.1/Example1.sce @@ -0,0 +1,71 @@ +clear +flag=1 +mode(-1) +clc + +printf("Example 1 : Show the method of file handling using the cat 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") + + +printf("\n# Enter the name of the file which you want to access \n\n") +nam=input('$ cat ','s') +printf("# This searches for a file named %s \n\n",nam) + + +if ~isfile(nam) then + flag=0 + printf("\n%s : file not found \n",nam) + printf("# Create a new file named %s?\n # y : Yes \n # n : No \n",nam) + resp=input('','s') + if resp=='y' then + flag=1 + printf("\n#***Enter the contents of the file %s*****\n# [Enter ^ in a newline to end and close the file]\n",nam) + printf('\n\n$ cat > %s #to create a file named %s and fill its contents\n',nam,nam) + fhdr=mopen(nam,'wt') + i=1 + while %t + cont=input(string(i)+'. ','s') + if (cont=='^') then + break + end + mfprintf(fhdr,"%s\n",cont) + i=i+1 + end + mclose(fhdr) + end +end + +if flag==1 then + i=1 + clc + printf("\n ===========> %s <============\n\n\n",nam) + fhdr=mopen(nam,'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('') +else + printf("\n\n# file %s is not found and not created also\n",nam) +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.1/Result1.pdf b/1088/CH5/EX5.1/Result1.pdf new file mode 100755 index 000000000..8a081276f --- /dev/null +++ b/1088/CH5/EX5.1/Result1.pdf @@ -0,0 +1,76 @@ + ans =
+
+ 1.
+
+-->exec("Example1.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 6 : Show the method of file handling using the cat 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)
+
+
+
+# Enter the name of the file which you want to access
+
+# This searches for a file named hither
+
+
+hither : file not found
+# Create a new file named hither?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hither*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hither #to create a file named hither and fill its contents
+
+ ===========> hither <============
+
+
+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.1/Result1.txt b/1088/CH5/EX5.1/Result1.txt new file mode 100755 index 000000000..8a081276f --- /dev/null +++ b/1088/CH5/EX5.1/Result1.txt @@ -0,0 +1,76 @@ + ans =
+
+ 1.
+
+-->exec("Example1.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 6 : Show the method of file handling using the cat 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)
+
+
+
+# Enter the name of the file which you want to access
+
+# This searches for a file named hither
+
+
+hither : file not found
+# Create a new file named hither?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hither*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hither #to create a file named hither and fill its contents
+
+ ===========> hither <============
+
+
+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/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)
diff --git a/1088/CH5/EX5.3/Example3.sce b/1088/CH5/EX5.3/Example3.sce new file mode 100755 index 000000000..fdd177a96 --- /dev/null +++ b/1088/CH5/EX5.3/Example3.sce @@ -0,0 +1,63 @@ +clear
+flag=1
+mode(-1)
+clc
+
+
+printf("Example 3 : Show the method of removing files in unix using the rm 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 which you want to delete : ",'s')
+
+flag=0
+printf("\n $ rm %s \t#deletes file %s\n",src,src)
+halt('')
+
+
+if isfile(src) then
+ printf('rm : remove %s (yes/no)? ? ',src)
+ resp=input(' ','s')
+ if resp=='y' then
+ mdelete(src)
+ flag=1
+ end
+ else
+ printf("\n%s : file not found \n",src)
+end
+
+if flag then
+ printf("\n $ cat %s # opening file %s to see if it exists \n",src,src)
+ if ~isfile(src) then
+ printf("\n%s : file not found \n ",src)
+ else
+
+ 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('')
+
+ end
+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.3/Result3.pdf b/1088/CH5/EX5.3/Result3.pdf new file mode 100755 index 000000000..1ae2a372e --- /dev/null +++ b/1088/CH5/EX5.3/Result3.pdf @@ -0,0 +1,54 @@ + ans =
+
+ 1.
+
+-->exec("Example3.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 3 : Show the method of removing files in unix using the rm 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)
+
+
+
+ $ rm hithere #deletes file hithere
+rm : remove hithere (yes/no)? ?
+ $ cat hithere # opening file hithere to see if it exists
+
+hithere : file not found
+
+
+
+$ 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.3/Result3.txt b/1088/CH5/EX5.3/Result3.txt new file mode 100755 index 000000000..1ae2a372e --- /dev/null +++ b/1088/CH5/EX5.3/Result3.txt @@ -0,0 +1,54 @@ + ans =
+
+ 1.
+
+-->exec("Example3.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 3 : Show the method of removing files in unix using the rm 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)
+
+
+
+ $ rm hithere #deletes file hithere
+rm : remove hithere (yes/no)? ?
+ $ cat hithere # opening file hithere to see if it exists
+
+hithere : file not found
+
+
+
+$ 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.4/Example4.sce b/1088/CH5/EX5.4/Example4.sce new file mode 100755 index 000000000..8c260e908 --- /dev/null +++ b/1088/CH5/EX5.4/Example4.sce @@ -0,0 +1,79 @@ +clear
+mode(-1)
+flag=1
+pwd
+xt=ans
+clc
+
+printf("Example 4 : Show the method of renaming files in unix using the mv 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 rename : ",'s')
+if isdir(src) then
+destn=input("# Enter the new name of the directory : ",'s')
+else
+ destn=input("# Enter the name of the file[or directory] which you want to move into : ",'s')
+end
+
+flag=0
+printf("\n $ mv %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('mv : 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]=movefile(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 moved 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 # No changes done in the file \n")
+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.4/Result4.pdf b/1088/CH5/EX5.4/Result4.pdf new file mode 100755 index 000000000..9b3ca8d53 --- /dev/null +++ b/1088/CH5/EX5.4/Result4.pdf @@ -0,0 +1,65 @@ + ans =
+
+ 1.
+
+-->exec("Example4.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 4 : Show the method of renaming files in unix using the mv 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)
+
+
+
+ $ mv hither hithern #copies file[or directory] contents of hither to hithern
+
+ $ cat hithern #to display the moved file hithern
+
+
+ ===========> hithern <============
+
+
+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.4/Result4.txt b/1088/CH5/EX5.4/Result4.txt new file mode 100755 index 000000000..9b3ca8d53 --- /dev/null +++ b/1088/CH5/EX5.4/Result4.txt @@ -0,0 +1,65 @@ + ans =
+
+ 1.
+
+-->exec("Example4.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 4 : Show the method of renaming files in unix using the mv 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)
+
+
+
+ $ mv hither hithern #copies file[or directory] contents of hither to hithern
+
+ $ cat hithern #to display the moved file hithern
+
+
+ ===========> hithern <============
+
+
+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.5/Example5.sce b/1088/CH5/EX5.5/Example5.sce new file mode 100755 index 000000000..a19064b12 --- /dev/null +++ b/1088/CH5/EX5.5/Example5.sce @@ -0,0 +1,58 @@ +mode(-1) +clear +flag=1 +clc + +printf("Example 5 : Show the method of file printing using the lp 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") + + +printf("\n# Enter the name of the file which you want to print \n\n") +nam=input('$ lp ','s') +printf("# This sends the file named %s to printer and gets status\n\n",nam) + + +if ~isfile(nam) then + flag=0 + printf("\n%s : file not found \n",nam) + printf("# Create a new file named %s?\n # y : Yes \n # n : No \n",nam) + resp=input('','s') + if resp=='y' then + flag=1 + printf("\n#***Enter the contents of the file %s*****\n# [Enter ^ in a newline to end and close the file]\n",nam) + printf('\n\n$ cat > %s #to create a file named %s and fill its contents\n',nam,nam) + fhdr=mopen(nam,'wt') + i=1 + while %t + cont=input(string(i)+'. ','s') + if (cont=='^') then + break + end + mfprintf(fhdr,"%s\n",cont) + i=i+1 + end + mclose(fhdr) + end +end +if flag then +s=toprint(nam) +if s then + printsetupbox() +else + printf("\n\nlp : printer busy \n") +end +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.5/Result5.pdf b/1088/CH5/EX5.5/Result5.pdf new file mode 100755 index 000000000..90943f6d4 --- /dev/null +++ b/1088/CH5/EX5.5/Result5.pdf @@ -0,0 +1,53 @@ + ans =
+
+ 1.
+
+-->exec("Example5.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 5 : Show the method of file printing using the lp 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)
+
+
+
+# Enter the name of the file which you want to print
+
+# This sends the file named hithern to printer and gets status
+
+
+
+
+$ 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.5/Result5.txt b/1088/CH5/EX5.5/Result5.txt new file mode 100755 index 000000000..90943f6d4 --- /dev/null +++ b/1088/CH5/EX5.5/Result5.txt @@ -0,0 +1,53 @@ + ans =
+
+ 1.
+
+-->exec("Example5.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 5 : Show the method of file printing using the lp 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)
+
+
+
+# Enter the name of the file which you want to print
+
+# This sends the file named hithern to printer and gets status
+
+
+
+
+$ 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.6/Example6.sce b/1088/CH5/EX5.6/Example6.sce new file mode 100755 index 000000000..999ca84c0 --- /dev/null +++ b/1088/CH5/EX5.6/Example6.sce @@ -0,0 +1,94 @@ +mode(-1)
+clear
+flag=1
+clc
+
+printf("Example 6 : Show the method of file counting using the wc 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")
+
+
+printf("\n# Enter the name of the file which you want to access \n\n")
+nam=input('$ cat ','s')
+printf("# This searches for a file named %s to display\n\n",nam)
+
+
+if ~isfile(nam) then
+ flag=0
+ printf("\n%s : file not found \n",nam)
+ printf("# Create a new file named %s?\n # y : Yes \n # n : No \n",nam)
+ resp=input('','s')
+ if resp=='y' then
+ flag=1
+ printf("\n#***Enter the contents of the file %s*****\n# [Enter ^ in a newline to end and close the file]\n",nam)
+ printf('\n\n$ cat > %s #to create a file named %s and fill its contents\n',nam,nam)
+ fhdr=mopen(nam,'wt')
+ i=1
+ while %t
+ cont=input(string(i)+'. ','s')
+ if (cont=='^') then
+ break
+ end
+ mfprintf(fhdr,"%s\n",cont)
+ i=i+1
+ end
+ mclose(fhdr)
+ end
+end
+
+if flag==1 then
+ c=1
+ w=0
+ l=0
+ clc
+ printf("\n $ cat %s \n",nam)
+ fhdr=mopen(nam,'rt')
+ while %t
+ [n,a]=mfscanf(fhdr,"%c")
+ if meof(fhdr) then
+ break
+ end
+
+ printf("%c",a)
+ c=c+1
+ if ascii(a)==32 then
+ w=w+1
+ end
+ if ascii(a)==10 then
+ w=w+1
+ l=l+1
+ end
+ end
+ mclose(fhdr)
+ halt('')
+ printf('\n\n$ wc %s #to get the count in file named %s \n',nam,nam)
+ halt('')
+ printf('\t%d\t%d\t%d %s\n',l,w,c,nam)
+ printf("\n# This means there are %d words,%d characters\n \t and %d lines in the file %s \n",w,c,l,nam)
+ printf('\n\n$ wc -l %s #to get the line count in file named %s \n',nam,nam)
+ halt('')
+ printf('\t%d %s\n',l,nam)
+ printf("\n# Number of lines \n")
+ printf('\n\n$ wc -w %s #to get the word count in file named %s \n',nam,nam)
+ halt('')
+ printf('\t%d %s\n',w,nam)
+ printf("\n# Number of words \n")
+ printf('\n\n$ wc -c %s #to get the character count in file named %s \n',nam,nam)
+ halt('')
+ printf('\t%d %s\n',c,nam)
+ printf("\n# Number of characters \n")
+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.6/Result6.pdf b/1088/CH5/EX5.6/Result6.pdf new file mode 100755 index 000000000..2f8918caf --- /dev/null +++ b/1088/CH5/EX5.6/Result6.pdf @@ -0,0 +1,84 @@ + ans =
+
+ 1.
+
+-->exec("Example6.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 6 : Show the method of file counting using the wc 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)
+
+
+
+# Enter the name of the file which you want to access
+
+# This searches for a file named hithern to display
+
+
+ $ cat hithern
+Hi I am Pranav
+I am an intern at FOSSE project
+I hope this project helps students well
+Thank You
+
+
+$ wc hithern #to get the count in file named hithern
+ 4 20 98 hithern
+
+# This means there are 20 words,98 characters
+ and 4 lines in the file hithern
+
+
+$ wc -l hithern #to get the line count in file named hithern
+ 4 hithern
+
+# Number of lines
+
+
+$ wc -w hithern #to get the word count in file named hithern
+ 20 hithern
+
+# Number of words
+
+
+$ wc -c hithern #to get the character count in file named hithern
+ 98 hithern
+
+# Number of characters
+
+
+
+$ 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.6/Result6.txt b/1088/CH5/EX5.6/Result6.txt new file mode 100755 index 000000000..2f8918caf --- /dev/null +++ b/1088/CH5/EX5.6/Result6.txt @@ -0,0 +1,84 @@ + ans =
+
+ 1.
+
+-->exec("Example6.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 6 : Show the method of file counting using the wc 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)
+
+
+
+# Enter the name of the file which you want to access
+
+# This searches for a file named hithern to display
+
+
+ $ cat hithern
+Hi I am Pranav
+I am an intern at FOSSE project
+I hope this project helps students well
+Thank You
+
+
+$ wc hithern #to get the count in file named hithern
+ 4 20 98 hithern
+
+# This means there are 20 words,98 characters
+ and 4 lines in the file hithern
+
+
+$ wc -l hithern #to get the line count in file named hithern
+ 4 hithern
+
+# Number of lines
+
+
+$ wc -w hithern #to get the word count in file named hithern
+ 20 hithern
+
+# Number of words
+
+
+$ wc -c hithern #to get the character count in file named hithern
+ 98 hithern
+
+# Number of characters
+
+
+
+$ 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.7/Example7.sce b/1088/CH5/EX5.7/Example7.sce new file mode 100755 index 000000000..cce0b8443 --- /dev/null +++ b/1088/CH5/EX5.7/Example7.sce @@ -0,0 +1,104 @@ +clear
+flag=1
+clc
+mode(-1)
+
+printf("Example 7 : Show the method of file handling using the od 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")
+
+
+printf("\n# Enter the name of the file which you want to access \n\n")
+nam=input('$ od ','s')
+printf("# This searches for a file named %s \n\n",nam)
+
+
+if ~isfile(nam) then
+ flag=0
+ printf("\n%s : file not found \n",nam)
+ printf("# Create a new file named %s?\n # y : Yes \n # n : No \n",nam)
+ resp=input('','s')
+ if resp=='y' then
+ flag=1
+ printf("\n#***Enter the contents of the file %s*****\n# [Enter ^ in a newline to end and close the file]\n",nam)
+ printf('\n\n$ cat > %s #to create a file named %s and fill its contents\n',nam,nam)
+ fhdr=mopen(nam,'wt')
+ i=1
+ while %t
+ cont=input(string(i)+'. ','s')
+ if (cont=='^') then
+ break
+ end
+ mfprintf(fhdr,"%s\n",cont)
+ i=i+1
+ end
+ mclose(fhdr)
+ end
+end
+
+if flag==1 then
+ i=1
+ clc
+ printf("\n $ od %s #to display %s in octal characters\n\n",nam,nam)
+ printf("\n ===========> %s <============\n\n\n",nam)
+ fhdr=mopen(nam,'rt')
+ while %t
+ [n,a]=mfscanf(fhdr,"%c")
+ if meof(fhdr) then
+ break
+ end
+ printf(" %o",ascii(a))
+ if ascii(a)==10 then
+ printf("\n")
+ end
+ i=i+1
+ end
+ mclose(fhdr)
+ printf("\n\n%d characters present in the file.\n[hit ENTER to continue]\n",i)
+ halt('')
+else
+ printf("\n\n# file %s is not found and not created also\n",nam)
+end
+
+flag=flag+1
+
+octs=blanks(0)
+if flag==2 then
+ i=1
+ clc
+ printf("\n $ od -bc %s #to display %s in octal characters\n\n",nam,nam)
+ printf("\n ===========> %s <============\n\n\n",nam)
+ fhdr=mopen(nam,'rt')
+ while %t
+ [n,a]=mfscanf(fhdr,"%c")
+ if meof(fhdr) then
+ break
+ end
+ printf(" %c ",a)
+ octs=octs+string(dec2oct(ascii(a)))+' '
+ if ascii(a)==10 then
+ printf("%s\n\n",octs)
+ clear('octs')
+ octs=blanks(0)
+ end
+ i=i+1
+ end
+ mclose(fhdr)
+ printf("\n\n%d characters present in the file.\n[hit ENTER to continue]\n",i)
+ halt('')
+else
+ printf("\n\n# file %s is not found and not created also\n",nam)
+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.7/Result7.pdf b/1088/CH5/EX5.7/Result7.pdf new file mode 100755 index 000000000..65157c1ca --- /dev/null +++ b/1088/CH5/EX5.7/Result7.pdf @@ -0,0 +1,91 @@ + ans =
+
+ 1.
+
+-->exec("Example7.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 7 : Show the method of file handling using the od 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)
+
+
+
+# Enter the name of the file which you want to access
+
+# This searches for a file named hithern
+
+
+ $ od hithern #to display hithern in octal characters
+
+
+ ===========> hithern <============
+
+
+ 110 151 40 111 40 141 155 40 120 162 141 156 141 166 12
+ 111 40 141 155 40 141 156 40 151 156 164 145 162 156 40 141 164 40 106 117 123 123 105 40 160 162 157 152 145 143 164 12
+ 111 40 150 157 160 145 40 164 150 151 163 40 160 162 157 152 145 143 164 40 150 145 154 160 163 40 163 164 165 144 145 156 164 163 40 167 145 154 154 12
+ 124 150 141 156 153 40 131 157 165 12
+
+
+98 characters present in the file.
+[hit ENTER to continue]
+
+ $ od -bc hithern #to display hithern in octal characters
+
+
+ ===========> hithern <============
+
+
+ H i I a m P r a n a v
+ 110 151 40 111 40 141 155 40 120 162 141 156 141 166 12
+
+ I a m a n i n t e r n a t F O S S E p r o j e c t
+ 111 40 141 155 40 141 156 40 151 156 164 145 162 156 40 141 164 40 106 117 123 123 105 40 160 162 157 152 145 143 164 12
+
+ I h o p e t h i s p r o j e c t h e l p s s t u d e n t s w e l l
+ 111 40 150 157 160 145 40 164 150 151 163 40 160 162 157 152 145 143 164 40 150 145 154 160 163 40 163 164 165 144 145 156 164 163 40 167 145 154 154 12
+
+ T h a n k Y o u
+ 124 150 141 156 153 40 131 157 165 12
+
+
+
+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.7/Result7.txt b/1088/CH5/EX5.7/Result7.txt new file mode 100755 index 000000000..65157c1ca --- /dev/null +++ b/1088/CH5/EX5.7/Result7.txt @@ -0,0 +1,91 @@ + ans =
+
+ 1.
+
+-->exec("Example7.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 7 : Show the method of file handling using the od 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)
+
+
+
+# Enter the name of the file which you want to access
+
+# This searches for a file named hithern
+
+
+ $ od hithern #to display hithern in octal characters
+
+
+ ===========> hithern <============
+
+
+ 110 151 40 111 40 141 155 40 120 162 141 156 141 166 12
+ 111 40 141 155 40 141 156 40 151 156 164 145 162 156 40 141 164 40 106 117 123 123 105 40 160 162 157 152 145 143 164 12
+ 111 40 150 157 160 145 40 164 150 151 163 40 160 162 157 152 145 143 164 40 150 145 154 160 163 40 163 164 165 144 145 156 164 163 40 167 145 154 154 12
+ 124 150 141 156 153 40 131 157 165 12
+
+
+98 characters present in the file.
+[hit ENTER to continue]
+
+ $ od -bc hithern #to display hithern in octal characters
+
+
+ ===========> hithern <============
+
+
+ H i I a m P r a n a v
+ 110 151 40 111 40 141 155 40 120 162 141 156 141 166 12
+
+ I a m a n i n t e r n a t F O S S E p r o j e c t
+ 111 40 141 155 40 141 156 40 151 156 164 145 162 156 40 141 164 40 106 117 123 123 105 40 160 162 157 152 145 143 164 12
+
+ I h o p e t h i s p r o j e c t h e l p s s t u d e n t s w e l l
+ 111 40 150 157 160 145 40 164 150 151 163 40 160 162 157 152 145 143 164 40 150 145 154 160 163 40 163 164 165 144 145 156 164 163 40 167 145 154 154 12
+
+ T h a n k Y o u
+ 124 150 141 156 153 40 131 157 165 12
+
+
+
+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.8/Example8.sce b/1088/CH5/EX5.8/Example8.sce new file mode 100755 index 000000000..9aa94ac9b --- /dev/null +++ b/1088/CH5/EX5.8/Example8.sce @@ -0,0 +1,85 @@ +clear
+flag=1
+clc
+mode(-1)
+
+printf("Example 8 : Show the method of comparing files using cmp 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")
+
+
+printf("\n# Enter the name of the two files which you want to compare \n")
+fil(1)=input('','s')
+fil(2)=input('','s')
+printf('\n\n $ cmp %s %s #to compare the files %s and %s\n',fil(1),fil(2),fil(1),fil(2))
+
+for i=1:2
+if ~isfile(fil(i)) then
+ flag(i)=0
+ printf("\n%s : file not found \n",fil(i))
+ printf("# Create a new file named %s?\n # y : Yes \n # n : No \n",fil(i))
+ resp=input('','s')
+ if resp=='y' then
+ flag(i)=1
+ printf("\n#***Enter the contents of the file %s*****\n# [Enter ^ in a newline to end and close the file]\n",fil(i))
+ printf('\n\n$ cat > %s #to create a file named %s and fill its contents\n',fil(i),fil(i))
+ fhdr=mopen(fil(i),'wt')
+ count=1
+ while %t
+ cont=input(string(count)+'. ','s')
+ if (cont=='^') then
+ break
+ end
+ mfprintf(fhdr,"%s\n",cont)
+ count=count+1
+ end
+ mclose(fhdr)
+ end
+end
+end
+
+
+if flag(1)&flag(2) then
+ clc
+ printf("\n $ cmp %s %s #to compare files %s and %s \n",fil(1),fil(2),fil(1),fil(2))
+ fhdr1=mopen(fil(1),'rt')
+ fhdr2=mopen(fil(2),'rt')
+ l=0
+ cr=1
+ while %t
+ [n,a1]=mfscanf(fhdr1,"%c")
+ [n,a2]=mfscanf(fhdr2,"%c")
+ if meof(fhdr1)&meof(fhdr2) then
+ printf(" \n# No output means both the files are identical \n")
+ break
+ elseif (meof(fhdr1)&~meof(fhdr2))|(meof(fhdr2)&~meof(fhdr1))|a1~=a2
+ printf(" %s %s differ : char %d , line %d \n",fil(1),fil(2),cr,l+1)
+ printf(" # This shows that %dth character in %dth line do not match\n\n",cr,l+1)
+ break
+ end
+ cr=cr+1
+ if ascii(a1)==10 then
+ l=l+1
+ cr=1
+ end
+ end
+ mclose(fhdr1)
+ mclose(fhdr2)
+ halt('')
+else
+ printf("\n\n# file %s or %s is not found \n",fil(1),fil(2))
+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.8/Result8.pdf b/1088/CH5/EX5.8/Result8.pdf new file mode 100755 index 000000000..29971e5c4 --- /dev/null +++ b/1088/CH5/EX5.8/Result8.pdf @@ -0,0 +1,195 @@ + ans =
+
+ 1.
+
+-->exec("Example8.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 8 : Show the method of comparing files using cmp 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)
+
+
+
+# Enter the name of the two files which you want to compare
+
+
+ $ cmp hithern hithrr #to compare the files hithern and hithrr
+
+hithrr : file not found
+# Create a new file named hithrr?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hithrr*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hithrr #to create a file named hithrr and fill its contents
+
+ $ cmp hithern hithrr #to compare files hithern and hithrr
+ hithern hithrr differ : char 5 , line 4
+ # This shows that 5th character in 4th line do not match
+
+
+
+
+$ exit #To exit the current simulation terminal and return to Scilab console
+
+........# (hit [ENTER] for result)
+
+ BACK TO SCILAB CONSOLE...
+Loading initial environment
+-->exec("Example8.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 8 : Show the method of comparing files using cmp 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)
+
+
+
+# Enter the name of the two files which you want to compare
+
+
+ $ cmp hithern hithrr #to compare the files hithern and hithrr
+
+hithrr : file not found
+# Create a new file named hithrr?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hithrr*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hithrr #to create a file named hithrr and fill its contents
+
+ $ cmp hithern hithrr #to compare files hithern and hithrr
+ hithern hithrr differ : char 7 , line 4
+ # This shows that 7th character in 4th line do not match
+
+
+
+
+$ exit #To exit the current simulation terminal and return to Scilab console
+
+........# (hit [ENTER] for result)
+
+ BACK TO SCILAB CONSOLE...
+Loading initial environment
+-->exec("Example8.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 8 : Show the method of comparing files using cmp 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)
+
+
+
+# Enter the name of the two files which you want to compare
+
+
+ $ cmp hithern hit #to compare the files hithern and hit
+
+hit : file not found
+# Create a new file named hit?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hit*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hit #to create a file named hit and fill its contents
+
+ $ cmp hithern hit #to compare files hithern and hit
+
+# No output means both the files are identical
+
+
+
+$ exit #To exit the current simulation terminal and return to Scilab console
+
+........# (hit [ENTER] for result)
+
+ BACK TO SCILAB CONSOLE...
+Loading initial environment
diff --git a/1088/CH5/EX5.8/Result8.txt b/1088/CH5/EX5.8/Result8.txt new file mode 100755 index 000000000..29971e5c4 --- /dev/null +++ b/1088/CH5/EX5.8/Result8.txt @@ -0,0 +1,195 @@ + ans =
+
+ 1.
+
+-->exec("Example8.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 8 : Show the method of comparing files using cmp 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)
+
+
+
+# Enter the name of the two files which you want to compare
+
+
+ $ cmp hithern hithrr #to compare the files hithern and hithrr
+
+hithrr : file not found
+# Create a new file named hithrr?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hithrr*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hithrr #to create a file named hithrr and fill its contents
+
+ $ cmp hithern hithrr #to compare files hithern and hithrr
+ hithern hithrr differ : char 5 , line 4
+ # This shows that 5th character in 4th line do not match
+
+
+
+
+$ exit #To exit the current simulation terminal and return to Scilab console
+
+........# (hit [ENTER] for result)
+
+ BACK TO SCILAB CONSOLE...
+Loading initial environment
+-->exec("Example8.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 8 : Show the method of comparing files using cmp 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)
+
+
+
+# Enter the name of the two files which you want to compare
+
+
+ $ cmp hithern hithrr #to compare the files hithern and hithrr
+
+hithrr : file not found
+# Create a new file named hithrr?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hithrr*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hithrr #to create a file named hithrr and fill its contents
+
+ $ cmp hithern hithrr #to compare files hithern and hithrr
+ hithern hithrr differ : char 7 , line 4
+ # This shows that 7th character in 4th line do not match
+
+
+
+
+$ exit #To exit the current simulation terminal and return to Scilab console
+
+........# (hit [ENTER] for result)
+
+ BACK TO SCILAB CONSOLE...
+Loading initial environment
+-->exec("Example8.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 8 : Show the method of comparing files using cmp 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)
+
+
+
+# Enter the name of the two files which you want to compare
+
+
+ $ cmp hithern hit #to compare the files hithern and hit
+
+hit : file not found
+# Create a new file named hit?
+ # y : Yes
+ # n : No
+
+#***Enter the contents of the file hit*****
+# [Enter ^ in a newline to end and close the file]
+
+
+$ cat > hit #to create a file named hit and fill its contents
+
+ $ cmp hithern hit #to compare files hithern and hit
+
+# No output means both the files are identical
+
+
+
+$ exit #To exit the current simulation terminal and return to Scilab console
+
+........# (hit [ENTER] for result)
+
+ BACK TO SCILAB CONSOLE...
+Loading initial environment
|