Tagged Questions
The term 'shell' refers to a general class of text-based command interpreters most often associated with the Unix & Linux operating systems.
5
votes
0answers
69 views
+100
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
68 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
59 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
32 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
27 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
66 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
164 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
395 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
23 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
55 views
Merging files in Bash
I had this homework assignment:
Create on the desktop a folder with your name.
Copy from your account [email protected] two files, ...
3
votes
2answers
96 views
Bash script to capture error message and change exit status
I'm working with the Perforce command line client. I ...
0
votes
1answer
46 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
32 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 ...
9
votes
1answer
63 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
79 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 ...
5
votes
1answer
24 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
51 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 ...
2
votes
2answers
127 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
124 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
45 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
52 views
Remove line numbers from shell history
I want to parse Linux history output and the commands parts only (without numbers):
...
6
votes
2answers
246 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
2answers
94 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
40 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
69 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
61 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
250 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
144 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
124 views
Bash script that checks if font is installed and installs it if necessary
This checks if a font is installed by using fc-list and grep. If the particular font is not installed, it offers to install it ...
5
votes
2answers
74 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
26 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
928 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.
...
2
votes
1answer
51 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 ...
12
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
120 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
97 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 ...
12
votes
3answers
206 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
59 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
72 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
326 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
50 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
162 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 ...
6
votes
2answers
250 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
160 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
2k 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
132 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
144 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
62 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 ...