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

3
votes
1answer
33 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? ...
1
vote
1answer
36 views

Unix shell script with master and source files

I have a script which is having too many modules. The script is working perfectly, but the only issue is it is taking too much time and I need to reduce the complexity of the script. I have a source ...
4
votes
3answers
58 views

Checking dates against a .properties file

I am writing a script that will check the set values against a .properties file and I am just wondering if there is any nicer way to write what I have here. ...
2
votes
0answers
46 views

Parallelized image transformations using GraphicsMagick

This is part of a script that I use for porting a TWRP Theme from one resolution to another. Respectively portrait to portrait and landscape to landscape. In this function entirely, it focuses on the ...
4
votes
1answer
83 views

Shell script that copies configuration and dotfiles to repository

A while ago I had the idea to store all the important configuration and dotfiles from my system in a Git repository. That saved me a few months ago: My harddrive died, but I could get back to work ...
8
votes
2answers
108 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. ...
4
votes
3answers
56 views

Bash script that checks if font is installed and installs it if necessary

I'm new to writing bash scripts and I was wondering if I could get someone's advice on a part of the script I'm working on. Intended purpose of code Check if a font is installed by using ...
5
votes
2answers
59 views

SSH chatting tool

I have taught myself some bash and already knew some AppleScript, so I have come up with this SSH chatting tool for OS X users. It allows you to chat from a terminal to another OS X computer. One ...
1
vote
1answer
19 views

Rebuilding WAR files in webapps directory

This script cleans up destination directory and copies file into it with new name. Can this intent be expressed more cleanly with shelly? ...
7
votes
4answers
888 views

PyDOS: Version 2.0

This is a follow up question to PyDOS shell simulation. You might remember PyDOS from my other post. I have now updated it and it's better than ever! Post any ideas below that could make it better. ...
1
vote
1answer
38 views

Parsing logs in sed efficiently

I have an application which log file has most lines start with a time/date, followed by a debugging level and the actual log message. Often I want to watch the output live and colors make it a lot ...
11
votes
3answers
1k views

PyDOS shell simulation

I have a big project called 'PyDOS', written in Python 3.4, and it's going very well. Post your answers of anything that could make it look cleaner. ...
3
votes
1answer
65 views

gcc installation script for Centos6.6

I have written this script to install gcc (here in version 4.9.2) on Centos6.6. I am only interested in C and C++ support. Please comment if this is any good and can I make it better before I get the ...
3
votes
0answers
52 views

Git merge script

The branches I need to merge are called test and test-passed. Merging will always be fast-forward, from test to test-passed as commits to test-passed are only done automatically from test. This is ...
10
votes
2answers
141 views

Mission impossible: beat everyone else to the queue

Your mission, should you chose to accept it, is to beat everyone else to the review tab so you get a chance to help out. This is a problem I've been running into lately. I go over to review tab, ...
7
votes
1answer
51 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 ...
3
votes
2answers
70 views

Producing recursive directory listings

This produces recursive directory listings(it's intended to do other things, so there will be something else instead of echo, but it isn't important), yet it isn't very intuitive. How can I improve ...
2
votes
1answer
117 views

Automating heap dumps from an Android device or emulator

I've automated the process of extracting and converting a heap dump from an Android device/emulator. I'd appreciate any feedback and improvements regarding style, bad practices, non-idiomatic code, ...
1
vote
2answers
37 views

Repeatedly fetching a URL until the response contains “state: INIT”

I am working on a project in which I need to make a URL call to one of my servers from a bash shell script. http://hostname.domain.com:8080/beat After hitting the above URL, I will be getting ...
2
votes
1answer
109 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
151 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 ...
5
votes
3answers
87 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
988 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
127 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
90 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
53 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
92 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 ...
3
votes
0answers
90 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
297 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
74 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
149 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 ...
3
votes
1answer
56 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
440 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
62 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
2k 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
138 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
163 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
133 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
89 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
262 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
53 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
228 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
142 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 ...
11
votes
3answers
830 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
463 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
5k 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
414 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
137 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
148 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
99 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 ...