Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Systems744
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
SHREYANSH JAIN
Systems744
Commits
54926411
Commit
54926411
authored
Aug 16, 2019
by
desiredeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding makefile and readme
parent
df8b1910
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
4 deletions
+66
-4
assignment1/Makefile
assignment1/Makefile
+34
-0
assignment1/demo
assignment1/demo
+6
-3
assignment1/myshell.c
assignment1/myshell.c
+1
-1
assignment1/readme.md
assignment1/readme.md
+25
-0
No files found.
assignment1/Makefile
View file @
54926411
# Sample Makefile (don't change the filename)
# Modify the below contents as needed
# CFLAGS?= <add flags required for GCC here>
# Considering 2 files in this sample
# file2.c has main(), and will create the executable that you want to run
# file1.c doesn't have main(), but file2.c uses file1.c, and so, file1.c
# needs to be compiled (hence -c flag added separately)
#Modify as per your need
all
:
rule1
#
rule2
rule1
:
myshell.c myshell.h
#
file1.c includes header1.h
,
which is in same dir
$(CC)
$(CFLAGS)
myshell.c
-o
myshell
# file2.c also includes header2.h
# rule2: file1.c file2.c header1.h # basically this tells that if any of these files are changed, next cmd should run
# $(CC) $(CFLAGS) myshell.c -o myshell
run
:
rule1
./myshell demo
clean
:
$(RM)
rule1
$(RM)
-r
*
.dSYM
$(RM)
myshell
# To compile, type this: make
# Then, execute by typing ./file2_executable <in_file>
# To compile and run: make run (this will also execute your program)
# Type
:
make clean to remove executable & other junk files
\ No newline at end of file
assignment1/demo
View file @
54926411
echo hi
echo hi >>
file
echo hi >>
out
pwd
echo hi >> file
pwd
\ No newline at end of file
echo hi >> out
pwd
wc -l < out
env
dir .
\ No newline at end of file
assignment1/myshell.c
View file @
54926411
...
...
@@ -16,7 +16,7 @@ int fileExists(char *path){
return
access
(
path
,
F_OK
)
!=
-
1
?
1
:
0
;
}
int
folderExists
(
c
onst
c
har
*
path
)
int
folderExists
(
char
*
path
)
{
struct
stat
stats
;
stat
(
path
,
&
stats
);
...
...
assignment1/readme.md
0 → 100644
View file @
54926411
# Myshell
Myshell is a LINUX shell made to gain implementation level clarity of OS.
## Compilation
```
bash
gcc
-o
myshell.c myshell
```
## Usage
```
bash
make run
# executes myshell with inputfile
./myshell.c <inputfile>
# batch mode
./myshell
# interactive mode
```
## Features
*
Background Process (&), Serial execution (&&), Parallel Execution (&&&)
*
IO redirection (>>,>,<) with &,&&,&&&
*
cd with corresponding changes in environment variables (PWD and OLDPWD)
*
dir, timed command execution
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to add.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment