Skip to content

anestisZioulis/Shelldom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

****************************************************
**     __        ___            __   __   v1.0    **
**    /__` |__| |__  |    |    |  \ /  \  |\/|    **
**    .__/ |  | |___ |___ |___ |__/ \__/  |  |    **
**                                                **
**                by Anestis Zioulis              **
**                 www.azioulis.com               **
****************************************************

About

The Shelldom CLI (Command Line Interface) is a program for Windows written in C. It tries to be an MS-DOS-like operating system that supports specific commands and options.

This program was created as an assignment for the lesson "Operating Systems I" at the IHU (International Hellenic University, Serres Campus) by Anestis Zioulis.

My assignment:

Develop a shell in the programming language of your choice. If the C language is used, avoid using the system() command and create your own functions.
Your CLI must support the following commands: dir, move, echo, type, and sort.

Additional commands:

I did implement some additional commands that were assigned to other students in order for the CLI to feel more usable and complete than just an assignment.
I implemented these extra commands: list, help, cd, create, read, del, tree, and cls.

Notice:

This program is NOT case-sensitive.





Demo





Installation

To use this program, you can download the latest release and use the executable inside. Also, you can compile the source code manually or through an IDE with a bundled compiler.


  • [1] Download the latest release and run the executable.
  • or

  • [2] Download JetBrains CLion or another IDE that includes the compiler.
  • or

  • [3] Download a tool chain, like MinGW, through the web and install it.

  • [3] If you opted to compile the source code yourself.
  • You downloaded the tool chain that has the compiler and installed it.
  • Open cmd, change the directory to the folder where the source file is, and check if gcc is available with the following command:
      gcc -v

  • If you see something like this, you are good to compile:
      Using built-in specs.
      COLLECT_GCC=gcc
      COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/lto-wrapper.exe
      Target: mingw32
      Configured with: ../src/gcc-9.2.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-static --enable-shared --enable-threads --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libgomp --disable-libvtv --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --disable-build-format-warnings --prefix=/mingw --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --with-isl=/mingw --enable-nls --with-pkgversion='MinGW.org GCC Build-20200227-1'
      Thread model: win32
      gcc version 9.2.0 (MinGW.org GCC Build-20200227-1)

  • Type:
      gcc -o shelldom.exe main.c
    and your executable should have been compiled.

  • You can run it in cmd by just typing it:
      shelldom.exe

Notice:
This program has libraries that work only on the Windows OS!





Main Commands

These commands were required by the lesson assignment.



  • DIR / LS
    • Display the contents of a directory in a column (default) or a list(-l).
      • dir <option> <path>
      • ls <option> <path>
          >> dir
          >> ls
          >> dir -l c:
          >> ls c:/deep/
          >> dir ../
          >> ls -l ../linux/impostor

  • MOVE
    • Move a file from one folder to another.
      • move <path/file> <path>
          >> move c:/mario.txt d:/adventures/
          >> move princess.jpg f:/img/
          >> move ../monition.pre E:/nd/is/near/

  • ECHO
    • Append a typed string to the provided file.
      • echo <alphanumeric_value> > <file>
          >> echo john55 > about.txt
          >> echo AbigSTRING_withText99 > sandiego.txt

  • TYPE
    • Merge all the text files in the current folder into a new one.
    • If it exists, ask for permission to replace, append, or cancel.
      • type /a *.* > <file>
          >> type /a *.* > about.txt
          >> type /a *.* > YotaFive.txt




Extra Commands

I added these extra commands that were not part of the assignment, so the CLI is more usable.



  • SORT
    • Read 32 numbers (byte size) from a binary file, sort them, and display them.
      • sort <file>
          >> sort numbers.bin

  • LIST
    • Show all the available commands.
      • list
          >> list

  • HELP
    • Show details about a specific command.
      • help <command>
          >> help sort
          >> help dir

  • CD
    • Change the current working directory.
      • cd <path>
          >> cd
          >> cd f:/
          >> cd ..
          >> cd ../backToTheFuture/




  • CREATE
    • Save user-inserted integer numbers from 1-255 in a text or binary file, and exit with 0.
      • If you want to create a binary file without .bin you have to use the option -b!
      • create <option> <file>
          >> create binaryFile.bin
          >> create -b binaryFileAsWell
          >> create textFile.txt
          >> create textFileWithoutExtension

  • READ
    • Reads text or binary files.
      • In order to read binary files without the .bin extension, use the option -b.
      • read <file>
          >> read data.bin
          >> read -b alsoBinary
          >> read numbers.txt
          >> read readme.md

  • DEL
    • Delete a file <file> or files like <file*> or all files *.* in the current folder.
      • del <file>
          >> del data.bin
          >> del dat*
          >> del *.*

  • TREE
    • Displays the structure of the current folder, sub-folders, and files.
      • tree <path>
          >> tree
          >> tree f:/
          >> tree ..
          >> tree ../backToTheFuture/


  • EXIT
    • Quits the program.
      • exit
          >> exit




Tools

The tools I used to create this assignment.


  • MingGW_GCC 9.2.0 compiler from MinGW-w64
  • Jetbrains CLion (Student/full version)
  • C Standard 99




Sources

Sources I used materials to create the project and readme.