Hi! This is my first shell project, and despite being very simple, i decided to post anyway to show my progress learning Linux and Shell scripting.
I'm studying C Programming right now, and typing more than to lines of code to compile and run my projects everytime was stressing me out. So i thought, what would a Real Software Engineer would do in my place?
He would automate this process, of course!
- It takes two arguments
- The first one is the name of your C script
- The second one is the name of your output file
- Ex: (./ccompiler.sh HelloWorld.c HelloWorld.out)
- If there is any error on the code it won't do anything besides showing the error, otherwise...
- It creates a folder called "executables"
- Enters the folder, executes the program and return to the input script folder
Click on the image, Or here to watch the demonstration
First off all make sure that you have the latest version of GCC installed, if not, open your terminal and type:
sudo apt update && sudo apt upgrade
Then simply install using the command
sudo apt install gcc
After installed, simply put the script in the same folder as the C script you want to compile an run it in the terminal with 2 arguments:
- The name of the script you want to compile
- The name of the output file
But before, don't forget to give the permission to execute the script
chmod -x ccompiler.sh
Now you can run it anytime you need!
./ccompiler.sh example.c example.out
This is a good piece of portifolio to me, but it could be a great piece of portifolio for us! So feel free to contribute in any way that you might think i would enhance this project
Made with 💞 in 🇧🇷