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

2
votes
1answer
84 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 ...
5
votes
2answers
90 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 ...
4
votes
3answers
43 views

Check disk space against a threshold

The below script is one I made to check the disk space on mounted partitions under Debian Wheezy. I tried adding a -d switch to force printing out the used data, ...
12
votes
1answer
399 views

Clone GitHub repository using Python

I want to backup my GitHub repositories since there is news about blocking GitHub in India. I wrote Python code to automate this and would like for it to be reviewed. ...
6
votes
2answers
115 views

Optimize bash script that concatenates output

I am trying to optimize my script that loops through a folder and extracts only the part of a file name before a date and the header of the file and outputs it into a different file using a delimiter. ...
4
votes
2answers
52 views

Reading options from .cfg file

I have a bash script that reads a config file with key/value pairs and uses these values to modify the functioning of other scripts correspondingly. Example .cfg file: ...
6
votes
1answer
45 views

Monitor Downloads folder and sort files as they are downloaded

I have written my first shell script that uses inotify-tools to monitor my Downloads directory. What I intend to do with the script is that, as soon as a file is ...
4
votes
2answers
53 views

Team git commit cleaner

I cleaned a big repository for my team with this Python code. My goal was for every developer in my team to check if some bad email are in the commit, and replace the information by the good one. I ...
2
votes
0answers
35 views

Replace while loop with sed

I have a script for school that mimics the cp command. Part of the assignment is to modify the script so that the while loop (that assigns stdin to the variable filelist) is instead done with sed. ...
0
votes
1answer
76 views

Is this iptables firewall bash script good? [closed]

I'm learning to use iptables to implement it in my company software. The goal is either to prevent the major attacks and to have good speed transferring files (ssh and ftp). Can you help me to improve ...
1
vote
1answer
67 views

Simple Bash backup script - follow-up

As a follow up to a previous question, linked here, I have revised the code and developed what I believe to be a better solution. In summary, the script should backup all files in a particular ...
3
votes
1answer
130 views

Simple Bash log backup script

I have developed the following script to zip and then remove all files with "*.log" extension in the file name that were modified yesterday. It's definitely not 100% at the moment. For example, it ...
1
vote
0answers
32 views

Basic Unix shell that displays prompt and has two simple commands [closed]

I'm writing a really basic shell for Unix in C. It displays a prompt, [almond], and it has two commands: Set Prompt and exit. I'm reading user input and passing it to a char array, then parsing it ...
3
votes
1answer
41 views

Can this bash shell script that checks for rvm ruby versions be improved?

As it is going to be used as part of some automation and not just at the command line I was wondering if it could be improved at all. Improve would mean any of: handle sad cases better handle ...
8
votes
1answer
411 views

Securely delete a file

I am trying to write a script to securely delete a file. What I am intending to do is to pad the file with /dev/zero once, and then with /dev/urandom three times and then delete the file. For now the ...
3
votes
1answer
53 views

Bash archiving script

I inherited a script at work the other day. I know very little about the command line in general but I'm not entirely new to programming. I am using this as an opportunity to learn... Very little ...
7
votes
3answers
479 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 ...
3
votes
2answers
120 views

Group and send all files to filetype folder

I have around ~2M of files in one folder, which I need to manage. So, I want to separate them in groups by their filetypes. Example: filenames ...
5
votes
2answers
76 views

Function autoloading in bash

I'm wondering if anyone can code review my code below. That's the core code of my little framework for bash in GitHub. ...
4
votes
1answer
120 views

Shell script for creating CR questions

Inspired by Tool for creating Code Review questions. This script generates a markdown document suitable for a CR question from a list of files. For each file it finds, it sends the following to ...
2
votes
2answers
83 views

Comparing if-else and case condition

I have a script used for installing few rpms depending on operating system type. Here in this example, the script will install packages on two system "centos" and "suse". The system names are listed ...
10
votes
1answer
238 views

Bash Music Player 2

This post is a follow-up to this. I wanted further reviews since the code I provided became too old when I got replies, which is why I'm providing it again here. I'm hoping I could get reviews for ...
6
votes
1answer
51 views

Directory of Snapshots

I have snapshots (photos) that I load off my camera's memory card, and store in a folder. Sometimes I have videos, and occasionally plain audio too (the camera can record just sound). Additionally, ...
4
votes
1answer
182 views

Bash Music Player

I have finally finished creating my first real project. It's just a simple music player that can provides the user with the latest music from any site (as long as it contains MP3 files) he provides ...
7
votes
1answer
114 views

Script for handling PPA's on Ubuntu

I'm writing a bash script to handle the PPA's on Ubuntu & derivatives. I was wondering how to know if I'm handling this the right way. So, the script works (flawlessly), but I posted it to a ...
8
votes
3answers
222 views

Iptables Lockdown

I have nginx serving files with uwsgi and I wanted to lock my server down just to allow SSH and Nginx to run. This is what I have: ...
9
votes
3answers
593 views

Bash script that updates Intel e1000e driver

I am now writing a small bash script that updates an Intel NIC driver to the latest version from the official website. Is there any way to improve\simplify the script? I want to avoid a lot of ...
5
votes
2answers
349 views

Text snippet creator/manager in Bash

Below is a script to create and manage text snippets. It is also posted on GitHub. Most of the code is error checking and displaying help because I wanted to make a solid command line interface. The ...
5
votes
2answers
3k views

Running a shell command and getting output

This is the code I'm currently using to run a shell command on the current machine, intended for use only with GNU/Linux at the moment: ...
1
vote
1answer
347 views

Interactive menu system in Bash [closed]

This is a simple loop menu script that I have for class. The goal was to make a menu with applicable commands. Menu: A. Greet me. (Greet the user by their username (using the whoami ...
3
votes
2answers
112 views

Mixing function parameters, commands and command arguments in Bash functions

I'm trying to write a bash function that will take a command such as xcode-select -v or brew -v that outputs a lot of extra ...
3
votes
2answers
124 views

Parallelizing upload

I needed smth that could send (scp/rsync) many files in parallel but that would not overload machine, firewalls on the way by starting e.g. 600 simultaneous uploads, so upload should be done in ...
4
votes
4answers
92 views

apt alternative for proxy environment with bash shell

As I am new to bash scripting, and want to use apt-get in my university. I know that many people have issues when trying to do so. My focus is simplicity and ease of use, but still need to be ...
3
votes
2answers
119 views

Removing NULL / empty fields

just wanted to check with you could this be done better: ...
2
votes
1answer
393 views

Bash to find all placeholder variables in a file and replace will real variables

I am looking to make a generic config file using variables such as: $PLACEHOLDER_USER Then after moving the file into the correct position I want to replace every instance of *$PLACEHOLDER_VARIABLE* ...
3
votes
1answer
452 views

Make a git repository read-only over ssh depending on the key used

I want a git repository, accessible over ssh, to be read-only when used with certain keys. With other keys access to the full system is okay. Here is my solution. git-readonlyshell: ...
3
votes
1answer
1k views

Send an email if a URL is down twice only

We want to check if a URL is down or not. But sometimes, the environment is down for maintenance for 3-4 hours and we don't want to keep sending emails during that time. I have written a shell script ...
5
votes
1answer
140 views

Project Bashory - Bash History

In effort to be more effective and productive with terminals I have started building a bash script. It is for handling the bash history of concurrently running terminals, archiving old commands, and ...
1
vote
0answers
54 views

zsh system status script

The following script is being used to generate the status line in wmii. I'm curious if there are faster/more efficient ways to find the various info I'm grabbing. I'm also a relative newbie when it ...
1
vote
1answer
66 views

Checking if a git repository needs to be updated

I made a small Vim distribution that uses vundle. I decided to make a small function that checks if the repository must be updated. ...
1
vote
1answer
143 views

Automating the install of postgresql from Shell

When my debian server deploys it can run a shell script so I wanted to make one to install postgreSQL, create a role, create two databases and then import a schema into one. Can anyone please look ...
3
votes
0answers
57 views

A z-shell function to quickly cd into projects

I think many know the problem of working with multiple projects: private projects, company projects, probably even projects for multiple companies. From day-one, I've always searched for better ways ...
3
votes
1answer
60 views

Input Columns with Awk

I wrote a small script to manipulate fields of a file based on the input of a user. Is there something I could've done better, or perhaps a better refactor? I do know however that I need a way to ...
1
vote
3answers
84 views

How to improve the computation speed of my shell script/program?

I have written a shell script to process my huge data files (each one having around 7,000,000 lines ~ a weeks data in a single file). Below is the sample of my data file (i.e., input file) structure: ...
2
votes
1answer
278 views

List contents of a folder using a shell script and mail the folder

I want to list the contents of a folder and mail the list using a shell script. I Came up with the following script, please let me know if it is okay: ...
2
votes
1answer
107 views

Bash script to manage multiple Java Development Kits installations

I'm writing a bash script to manage multiple JDKs, the script is very simple, you have to choose a directory when you store all the jdk's, and the script maintain ...
4
votes
1answer
1k views

Bash Shell Script uses Sed to create and insert multiple lines after a particular line in an existing file

This code seems to work, but I'd like someone with shell-fu to review it. Is the temp file a good idea? How would I do without? Is sed the right tool? Any other general advice for improving my ...
3
votes
1answer
383 views

Improve a script to generally check status of several git repos

I've tried to write a bash script that gives me a general overview of the status of git repos I have cloned/created. It's not meant to replace git status by any ...
5
votes
2answers
86 views

Make a directory and change to it

A basic shell function to create a directory and change to it goes like this: mkcd () { mkdir "$1" && cd "$1"; } This works well in many cases but breaks ...
7
votes
3answers
195 views

Can I speed up this simple versioning/backup script?

I'm writing a simple automatic backup/versioning bash script. It should basically mirror a directory structure somewhere, and then copy files over there when they've been altered. The ghost files ...