All Questions
28
questions
1
vote
1
answer
135
views
Shell implementation in C
I made a small shell implementation in C.
It reads stdin and executes the command. It can also take in a file name from argv and execute all the arguments in the ...
3
votes
1
answer
210
views
C implementation of a minimal shell
I wrote a program that implements a minimal shell and reads from standard input commands and executes them.
Is my implementation ok? I admit that I helped myself a lot with google. Could I have ...
3
votes
2
answers
115
views
Is this implementation of the `mv` command the most appropriate? It can be improved?
I wrote a program that implements the same function as the mv command.
I know this is not the best implementation, so I would like some suggestions for improvement, ...
6
votes
4
answers
380
views
Interactive shell for Arduino
Goal
I needed to interact with microcontrollers (ESP8266 & ESP32) via the Serial interface, so I wrote a small interactive shell with the command pattern.
The defined commands can either accept no ...
7
votes
1
answer
2k
views
Parsing and Simple Shell in C
I wrote this simple shell in C for a university assignment on operating systems
(My guess is that it's just the beginning and the next assignments will add to this code).
The program prints the prompt ...
2
votes
1
answer
49
views
Portable Build System for Virtual Machine with Editor and Unit Tests
I am automating the building and unit testing of a personal
project using shell scripts
, CMake and make on the latest version of Fedora Linux. I have also tested building on the latest version of ...
3
votes
1
answer
44
views
Check shell programs for portability
There are lots of shell programs that have /bin/sh as interpreter, yet use some features that are specific to bash or other popular shells. I have written a little ...
18
votes
2
answers
2k
views
Yet another shell in C
I wrote this shell in C about a semester ago for a university assignment on operating systems. Even though I got a score of 10/10 in this assignment, I doubt it deserved it -
The pipeline ...
7
votes
1
answer
744
views
Basic shell in C
I'm new to C and created this shell to test my knowledge. It takes input from stdin, checks whether the full path has been given, if not, appends input to /bin/ and then executes. How can I improve; ...
3
votes
1
answer
145
views
Command manipulation functions for a toy shell program
I am writing a small program that is supposed to act as a shell of some sorts. It operates off of a few basic structures, one of them being a command, a ...
10
votes
2
answers
308
views
mini-(Docker)-shell
I was given an assignment to write a mini-shell:
To write your own shell, you will need to start with a C program that
will prompt the user for input and accept in a number of arguments
from a ...
2
votes
1
answer
295
views
Parsing and executing a simple shell script
I'm writing a simple shell and want to parse and execute a simple shell script.
...
-1
votes
1
answer
84
views
More error-checking
The purpose of this code is to check for errors in my code for a custom shell.
In a previous answer, they say that my code didn't have error-checking.
You need to check the result of every ...
2
votes
1
answer
338
views
POSIX arithmetic expansion
I understand that a shell should be able to perform arithmetic expansion. My shell can do it:
$ echo $((1+2*3+4*5))
27
My solution uses the lemon parser where I ...
3
votes
1
answer
303
views
Running shell commands in a pipeline
I'm writing a shell in C for Linux and BSD. My code was unreadable before but I did a rewrite and now it is much more readable. The purpose of the code is to create a command pipeline and execute it.
...
-4
votes
1
answer
77
views
Creating a struct
Mat told me to create a struct
create a struct for the individual commands and arguments. It should
have something like the "executable" name, number of args and arg
list. Create a few ...
2
votes
2
answers
968
views
Shell command-line interpreter with pipeline parsing
Like many others I've been writing a shell command-line interpreter that can do a pretty decent pipeline parsing, first it splits the command at pipeline char (|), then it splits the substring at ...
2
votes
1
answer
130
views
C main function for POSIX shell
I got a pretty large main function that I want to break up in smaller helper functions. Can you help me suggest what to break out into helper functions? The ...
0
votes
1
answer
51
views
Handle builtin commands
I've written a small C function to handle the builtin commands of a custom shell that I'm writing in C. Is it better to use a switch instead?
...
0
votes
1
answer
3k
views
Tokenizing a shell command
I want to handle input like the following
ls -al | awk '{print $1}'
Now to parse it I couldn't tokenize at whitespace because of the quotations and I had to make ...
2
votes
2
answers
1k
views
Basic shell implementation
Here is a small project to implement a basic shell. It is a personal ongoing project to keep system call usage fresh. It currently does background processes and some basic signal handling.
I am ...
5
votes
1
answer
379
views
Constructing a simple shell from scratch
I'm actually doing my whole shell in C from scratch from a Linux computer.
The thing is that I think we all do our best from creating the simplest things that can be explained easily. And I'm not sure ...
4
votes
2
answers
593
views
A basic C Shell for Linux
I have written a basic C Shell. It features the builtins cd, programmer, ver and ...
8
votes
2
answers
252
views
Recovery Shell (rsh)
I wrote a shell to test my understanding of processes etc. It is not supposed to comply with POSIX or anything, just to allow people to run simple commands with simple arguments.
...
7
votes
1
answer
148
views
Restrictive stupid shell
I'm attempting to create a replacement shell for /bin/bash, that only permits commands defined by a read only config file. These commands will be run by absolute paths, and take no arguments. I'm not ...
2
votes
1
answer
865
views
Very basic shell on microcontroller in C - follow-up
This is a follow-up of: Very basic shell on microcontroller in C
A few days back I've asked for a review on a simple shell parser in c. Based on the answers, I've restructured my code to use a table-...
6
votes
2
answers
2k
views
Very basic shell on microcontroller in C
Objective: A lightweight shell that runs on a microcontroller (MSP430) and parses incoming data into a command and additional
parameters.
Requirements:
Support of quoting in ...
7
votes
3
answers
29k
views
Simple shell in C [closed]
I am just getting started with C and made this simple shell to test my understanding of some basic principles. The shell reads commands from standard input, forks itself and executes the command. How ...