diff options
Diffstat (limited to '1088/CH5/EX5.4')
-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 |
3 files changed, 209 insertions, 0 deletions
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)
|