The term 'shell' refers to a general class of text-based command interpreters most often associated with the Unix & Linux operating systems.

learn more… | top users | synonyms

0
votes
0answers
13 views

Simple import system for a large shell program

I am writing a large shell program with several source files to keep things organized and was looking for a basic import system that accomplishes two goals. Avoid sourcing entire files for access to ...
0
votes
0answers
11 views

shell script to display environment variables

This shell script writes my environment variables and if there is an argument, the shell script will grep for the argument in the environment variables. ...
1
vote
0answers
24 views

Tab completion for custom shell

The purpose of the code is to enable tab completion for a custom shell I'm writing. The target OSes are Linux and OpenBSD. I had to make a conditional include that I hope is correct: ...
4
votes
2answers
20 views

Isolate URLs from other text around it and put each on own line (with sed)

I have a small shell script that uses sed to take an input file of URLs with hand-written notes around them and strips the notes and puts each URL on its own line. ...
1
vote
1answer
38 views

Parsing and executing a simple shell script

I'm writing a simple shell and want to parse and execute a simple shell script. ...
2
votes
1answer
42 views

Sort and source configuration files from one of two directories

In a zsh I want to loop over all files in a configuration files' directory (/etc/myapp/) to source them. The files should be sourced in order and are named with two ...
-1
votes
1answer
36 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 ...
3
votes
1answer
33 views

Install ruby using rbenv in bash script

I want to write an automated bash script for installing ruby and rails using rbenv. But I am getting issue of session reload in terminal. My bash script:- ...
2
votes
1answer
94 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
1answer
67 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. ...
-3
votes
1answer
44 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
2answers
51 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 ...
3
votes
1answer
28 views

Displaying a table of shell aliases

I'm just getting into bash and sh scripting. I mostly just stub out little convenience or exercise scripts for myself, but I recognize I may be flaunting best practices at times. My question is ...
2
votes
1answer
52 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
1answer
28 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
1answer
79 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 ...
4
votes
1answer
36 views

Simple shell script to backup to Amazon over iSCSI

The script works but I know that it can be improved. Please note that my scripting skills are very basic :) (as it can be seen in my Frankenstein script – I took bits and pieces of the code from ...
3
votes
1answer
48 views

Display the last N lines of a text file with line numbers in reverse order

Do you think the way I'm doing it is fine? Is this the most typical way to do it? Share your thoughts please. ...
1
vote
1answer
24 views

POSIX shell script using a string to store command arguments

Background I’ve started putting all my configuration files (which include many shell files) under version control. In the Git repository, I’ve configured a pre-commit hook that runs the ...
0
votes
0answers
51 views

Resolving the path to a Bash script

I wrote a function to resolve the full path to the current Bash script, and I'm wondering if it's SOLID: ...
4
votes
2answers
77 views

MS-DOS style OS

This is a very basic text-based operating system I've been working on. I started working with python a few weeks ago and this project only a few days ago, so there are probably better ways I can do ...
1
vote
1answer
55 views

Ruby backup/restore for provisioning

This is my second Ruby coding attempt. Also - this is my first OOP usage in Ruby. I'm using if __FILE__ == $0 form here - same as it is in Python because it's ...
2
votes
1answer
20 views

Shell agnostic startup flow - env, profile, rc, login

The goal of these files is to have some common behavior between Bash and Zsh when starting them. As is known, when Bash starts as a login shell it will source the first found of the following in your ...
3
votes
2answers
48 views

Nagios plugin webdav check 2

Original post: nagios plugin webdav check According to the good advice I have received I've made some modifications to the code: ...
4
votes
1answer
128 views

FFmpeg command line for showing two videos side by side

Here is command line for playing two videos side by side in sync in FFmpeg (ffplay). It can be useful for comaring videos, for example. ...
6
votes
0answers
136 views

Extracting single files from a tarball (spreadsheets)

I've created a program that will pull spreadsheets out of a large tarball. First it specifies the file name through the "folio" number which is given as an argument when the program is called. From ...
3
votes
2answers
90 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
1answer
80 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 ...
5
votes
1answer
48 views

Function to get specified key from /proc/cpuinfo

On Linux, the file /proc/cpuinfo returns a set of key-value pairs, where the key and value are separated by a colon and each pair has its own line. It's a bit more ...
1
vote
1answer
31 views

Print values of an array while stripping out some parts of the string

Is there a more efficient way to run this? I am especially interested in a way which perhaps does not require a for loop... ...
7
votes
1answer
113 views

Detecting keyboard input

I want to use JavaFX as a solution to Java's issues with buffered input making things like 'press any key to continue' not easy. I plan to use an event listener to detect keyboard input. But before I ...
11
votes
2answers
268 views

Editing Javascript and rendering HTML in one window v2

I wanted to revisit this site to post some recent work I put into this small project. I was able to add a console as suggested; but I thought I would ask here how my coding stying is before I work on ...
10
votes
3answers
433 views

Shell Script (Bash) to sum multiples of different arguments below a number

I'm interested in learning how to create shell scripts with bash so here's one of my first exercises, taken from here. It is an extension of the problems Elementary - 4 and 5. The goal of the program ...
2
votes
1answer
44 views

Expanding tilde inside assignments and strings in bash

Inspired by the work Charles Duffy did in this answer and the work of Jonathan Leffler in this one and because I couldn't leave well-enough alone. I went and wrote expandTilde.sh: ...
2
votes
1answer
47 views

Git post-receive hook writen as a POSIX shell script (utilising a named pipe)

This is my first piece of code to post here. I wrote this script as a post-receive hook for a Git repository but I’m not so concerned with the Git parts (I’d like to have the part marked with ...
-2
votes
1answer
58 views

Merging files in Bash

I had this homework assignment: Create on the desktop a folder with your name. Copy from your account XYZ@xyz.com two files, ...
3
votes
2answers
115 views

Bash script to capture error message and change exit status

I'm working with the Perforce command line client. I ...
0
votes
1answer
51 views

Print a “shebang” line, or prepend it to a file

This is a sort-of-useless "utility" I wrote to learn my way around shell programming better. My concerns are: Is the code readable? Could it be more efficient, or just simpler? The logic ends up ...
2
votes
2answers
35 views

Split redirecting to multiple files in bash

A function mycommand which runs command and: Gives me three log-files which are: *.stdout.log: everything from ...
10
votes
1answer
79 views

POSIX shell compatible and POSIX conforming dirname implementation

The discussion in the comments of this answer made me wonder how hard it would be to write a built-in only version of dirname. This is what I ended up with but I'm ...
4
votes
3answers
92 views

Shell script to detect router slider status

I have an openwrt router (TP-Link MR3040) and on boot I have it check the slider (AP, WISP, 3G/4G mode). The goal was to have it execute the current "slider status" vs the old one, or do nothing if it'...
5
votes
1answer
28 views

Shell Script Audio Logger

I created my first shell script. It's an audio logger that runs on the hour for an hour and restarts. Although if it is started within the hour it will only run until the end of the hour. I've added ...
4
votes
1answer
52 views

Optimising script that does simple renaming of files

I have recently written some code in Bash where I'm starting to program some things and I think I'm overcomplicating the script I wrote. I'd like to make it simpler so that in future I would avoid ...
3
votes
2answers
164 views

A basic C Shell for Linux

I have written a basic C Shell. It features the builtins cd, programmer, ver and ...
8
votes
2answers
130 views

Backup Linux system to web

First I create a .tar of the root directory with all the file permissions saved and excluding all irrelevant directories (are these the right folders to be ...
3
votes
1answer
35 views

Removing ASCII “frame” around text

I sometimes save nice fortune outputs to my Evernote. The data looks like this: ...
3
votes
1answer
51 views

Shell binary search with sorted input

I have coded binary search in shell, just for practice. Input Input data is already sorted set of numbers streamed to the script. $1 is the sought number. ...
3
votes
1answer
54 views

Remove line numbers from shell history

I want to parse Linux history output and the commands parts only (without numbers): ...
6
votes
2answers
333 views

Address book app to learn bash

I'm fairly proficient in C and Python, but want to learn some skills for administrating my new Linux machine. I wrote this simple address book app to teach myself shell scripting. This is the first ...
4
votes
3answers
209 views

Validating a credit card number using Luhn's algorithm

I implemented Luhn's algorithm explained on Wikipedia to validate a credit card number, in Bash. Does this code follow good practices? ...