summaryrefslogtreecommitdiff
path: root/Unix_Concepts_And_Applications_by_S_Das/1-Getting_Started.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Unix_Concepts_And_Applications_by_S_Das/1-Getting_Started.ipynb')
-rw-r--r--Unix_Concepts_And_Applications_by_S_Das/1-Getting_Started.ipynb350
1 files changed, 350 insertions, 0 deletions
diff --git a/Unix_Concepts_And_Applications_by_S_Das/1-Getting_Started.ipynb b/Unix_Concepts_And_Applications_by_S_Das/1-Getting_Started.ipynb
new file mode 100644
index 0000000..c58aa4f
--- /dev/null
+++ b/Unix_Concepts_And_Applications_by_S_Das/1-Getting_Started.ipynb
@@ -0,0 +1,350 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 1: Getting Started"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.1: Date_and_Time.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear()\n",
+"dt=getdate()\n",
+"//clc()\n",
+"disp('Example 1 : Write a code sequence to display the current date and time')\n",
+"printf('\n**********************************************************\n')\n",
+"disp('Answer : ')\n",
+"printf('\n')\n",
+"printf('The current date is %s and the current time is %d : %d : %d \nThe day is ',date(),dt(7),dt(8),dt(9))\n",
+"select dt(5) \n",
+" case 1 then\n",
+" printf('Sunday')\n",
+" case 2 then\n",
+" printf('Monday')\n",
+" case 3 then\n",
+" printf('Tuesday')\n",
+" case 4 then\n",
+" printf('Wednesday')\n",
+" case 5 then\n",
+" printf('Thursday')\n",
+" case 6 then\n",
+" printf('Friday')\n",
+" case 7 then\n",
+" printf('Saturday')\n",
+"end\n",
+"printf('.')\n",
+"printf('\n**********************************************************\n')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.2: Clearing_the_Screen.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear()\n",
+"//clc()\n",
+"disp('Example 2 : Clear the current session window at the press of a key')\n",
+"printf('\n**********************************************************\n')\n",
+"disp('Answer :')\n",
+"disp('')\n",
+"disp('Press any key to clear the Session window ')\n",
+"halt('')\n",
+"//clc()"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.3: Calendar_display.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear()\n",
+"//clc()\n",
+"printf('Example 3 : Display the calendar of the current month and of a date \nentered by the user ')\n",
+"printf('\n**********************************************************\n')\n",
+"printf('Answer :\n\n\n')\n",
+"printf('The current date is %s whose calendar is ',date())\n",
+"ct=calendar()\n",
+"clc(19)\n",
+"disp(ct(1))\n",
+"disp(ct(2))\n",
+"disp(ct(3))\n",
+"printf('\n--------------------------------------------------------------------------------------\n')\n",
+"printf('Enter a date whose calendar is to be displayed \n')\n",
+"x=input('Enter in the format [dd,mm,yyyy],ALONG WITH THE PARENTHESIS ')\n",
+"ct=calendar(x(3),x(2))\n",
+"clc(21)\n",
+"disp(ct(1))\n",
+"disp(ct(2))\n",
+"disp(ct(3))\n",
+"printf('\n\nEntered Date is %d - %d - %d \n',x(1),x(2),x(3))\n",
+"printf('\n***********************************************************')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.4: Users_present.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear\n",
+"clc\n",
+"disp('Example 4 : Display all the current users in the Current Unix Session')\n",
+"disp('')\n",
+"printf('\n*******************************************************************\n')\n",
+"disp('Answer :')\n",
+"printf('THE FOLLOWING LINES OF CODE RUN \nONLY IN SCILAB INSTALLED IN UNIX ENVIRONMENT.....')\n",
+"printf('\nTHE CONSOLE GETS EXITED IN OTHER\n OPERATING SYSTEMS')\n",
+"if(getos() ~= 'Linux' )then\n",
+" disp('')\n",
+" halt('Press any key to end the script since the OS is not Linux')\n",
+" printf('Close the Scilab Console?....\ny :Yes\nAny other key:No')\n",
+" st = input('','s')\n",
+" clc(1)\n",
+" if( st == 'y') then\n",
+" exit\n",
+" end\n",
+"else\n",
+" unix_w('who')\n",
+"end\n",
+"printf('\n*******************************************************************\n')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.5: Processes.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear\n",
+"clc\n",
+"disp('Example 5: Display all the current working processes in the current session')\n",
+"printf('\n*******************************************************************\n')\n",
+"disp('Answer : ')\n",
+"disp('')\n",
+"halt('Press Enter to display the processes')\n",
+"if (getos()=='Windows') then\n",
+"clc(1)\n",
+"powershell('ps')\n",
+"else\n",
+" clc(1)\n",
+" unix_w('ps')\n",
+"end\n",
+"printf('\n*******************************************************************\n')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.6: Listing_Files.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear\n",
+"mode(-1)\n",
+"clc\n",
+"\n",
+"disp('Example 6 : Display all the files in the current directory and files beginning with ->Ex<-')\n",
+"printf('\n*******************************************************************\n')\n",
+"disp('Answer : ')\n",
+"halt('Press [Enter] to continue')\n",
+"disp('Files in the current directory ')\n",
+"mode(0)\n",
+"ls\n",
+"mode(-1)\n",
+"halt('Press Enter to see files beginning with ->Ex<-')\n",
+"printf('\n-------------------------------------------------------------------------------------------------\n')\n",
+"disp('Files Beginning with ->Ex<-')\n",
+"mode(0)\n",
+"ls Ex*\n",
+"mode(-1)\n",
+"printf('\n*******************************************************************\n')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.7: Number_of_files_Unix_only.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clear\n",
+"clc\n",
+"disp('Example 6 : Display the number of files in the current directory ')\n",
+"printf('\n*******************************************************************\n')\n",
+"disp('Answer :')\n",
+"printf('THE FOLLOWING LINES OF CODE RUN \nONLY IN SCILAB INSTALLED IN UNIX ENVIRONMENT.....')\n",
+"printf('\nTHE CONSOLE GETS EXITED IN OTHER\n OPERATING SYSTEMS')\n",
+"if(getos() ~= 'Linux' )then\n",
+" disp('')\n",
+" halt('Press any key to end the script since the OS is not Linux')\n",
+" printf('Close the Scilab Console?....\ny :Yes\nAny other key:No')\n",
+" st = input('','s')\n",
+" clc(1)\n",
+" if( st == 'y') then\n",
+" exit\n",
+" end\n",
+"else\n",
+" unix_w('ls|wc')\n",
+"end\n",
+"printf('\n*******************************************************************\n')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.8: Programming_basics.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear\n",
+"clc\n",
+"disp('Example 8: Write a code-sequence to find show primitive programming ')\n",
+"printf('\n*******************************************************************\n')\n",
+"disp('Answer : ')\n",
+"disp('The following programme takes an input from the user adds 2 to it and displays the result')\n",
+"disp('')\n",
+"halt('Ready???...Press Enter to continue')\n",
+"a=input('Enter any number : ')\n",
+"clc(1)\n",
+"printf('\n\nThe new result is %d',a+2)\n",
+"printf('\n*******************************************************************\n')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.9: Exitting.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear\n",
+"clc\n",
+"disp('Example 9: Write a code-sequence to exit the console')\n",
+"printf('\n*******************************************************************\n')\n",
+"disp('Answer : ')\n",
+"halt('Ready???...Press Enter to continue')\n",
+" printf('Close the Scilab Console?....\ny :Yes\nAny other key:No')\n",
+" st = input('','s')\n",
+" clc(1)\n",
+" if( st == 'y') then\n",
+" exit\n",
+" end\n",
+"printf('\n*******************************************************************\n')"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}