The term 'shell' refers to a general class of text-based command interpreters most often associated with the Unix & Linux operating systems.
3
votes
0answers
20 views
Bash manual page selection menu (version 3)
This is an interactive script for selecting and reading the manual pages from the terminal command line. This is the 3rd version of this script. If you want to see the evolution of this script, follow ...
3
votes
0answers
25 views
Bash manual page selection menu (version 2)
This is update to a previously asked question Bash manual page selection menu. This script generates a menu for the user to select which manual page he/she would like to read.
...
5
votes
0answers
25 views
A shell script to mount a disk image file
I'm trying to create a bash shell script which mounts a disk image file. Not only that but checks to see if the disk image already exists. Is there anyway I could improve my script? Currently my ...
3
votes
1answer
42 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 ...
1
vote
1answer
51 views
Java executing rSync shell command with progress display
I basically want to write a simple GUI program to sync to directories using the rsync command. The core part of the code is below. My main question is, do I need to ...
2
votes
0answers
18 views
User Login Notifier [closed]
I'm creating a shell script that is supposed to email me whenever a specific user logs in. However, I'm wondering how I would go about doing this for more than one user. This is my code:
...
1
vote
1answer
17 views
Checking the status of a ZFS pool
I'd like to see if there are any suggestions on how to improve a simple conditional test at the beginning of a backup script that verifies a ZFS volume is "online" and has the name "tank".
For ...
1
vote
0answers
38 views
Ansible shell command status check
I have a task which checks the status of a process running on a Linux server using a shell. The task should report as failed when the status is NOT RUNNING. The following works but is there a better ...
5
votes
0answers
50 views
Safe (and restricted) version of eval
I have built a shell function aimed to perform the following:
Given a string as first argument, perform safe expansions (i.e. those that cannot cause arbitrary code execution and only produce string ...
8
votes
1answer
74 views
My Pythonic take on Psexec
I've created a little program that basically does the same thing as psexec. It will connect to a host via computer name, or IP address, run the given command, and log the output into a file (little ...
3
votes
1answer
34 views
Backup a SQLite database
I want to backup a single SQLite database daily up to 30 days back, but I also want to keep at least 2 backups at all times (i.e. if there have been no backups in the last 30 days because the database ...
2
votes
1answer
30 views
Extract thoughput value from JMeter log file
I use JMeter for load testing and want to report error on CI pipeline when application though put is less than 1/sec. JMeter logs summary of results as -
...
3
votes
2answers
68 views
Bash script to rename subfolder to include name of parent folder
Here's the current structure of my directory.
.
├── Show 1
│ ├── Season 1
│ └── Season 2
├── Show 2
├── Season 1
└── Season 2
I want to rename the ...
3
votes
0answers
50 views
Iterating through an array once [closed]
I am tasked with writing a script that analyzes code and attaches a comment with #Loopn or #Selection n that corresponds with ...
2
votes
1answer
26 views
Script to execute arbitrary command on each Git project in a directory
The idea is simple, most people have some one directory containing all their projects as subdirectories. When you are in the top directory and you run this script like so ...
5
votes
2answers
79 views
Optimize text search in files with Bash
I would like to get some performance improvement suggestions to a simple project I made using Bash in Linux.
The target is to read all the *.desktop files, and ...
3
votes
0answers
67 views
Daemonizing shell scripts - MqSH
This is an mqtt driven, interactive, and asynchronous remote shell daemon written in bash. I call it "MqSH" or simply "mq". It works with bash, the busybox ash shell, and perhaps other Bourne-like ...
3
votes
1answer
47 views
OpenVPN Authentication Script
I wrote a shell script to authenticate users connecting to an OpenVPN server. When a user attempts to connect, OpenVPN executes the script with the username and password variables sends.
The script ...
2
votes
2answers
58 views
Passing help options to a bash script
I used this code to give -h(help) options to my bash script. It's working fine and I wanted to get the code reviewed.
...
10
votes
2answers
174 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 ...
4
votes
2answers
70 views
Generate SQL UPDATE from Excel CSV file
I must write updates in a database from a flat file (CSV). I want to do that in the shell, with tools such as AWK.
...
2
votes
2answers
35 views
High CPU utilisation for Logs Manager shell script
I have written a shell script to manage the tcpdump pcap logs and syslog files in my Linux board, so as to maintain the disk usage to maximum of 70%.
The script checks for the disk usage every ...
2
votes
1answer
35 views
Fahrenheit / Celsius temperature converter - follow-up
This is an updated version of the script Fahrenheit / Celsius temperature converter. I have changed the script to be non-interactive, using positional parameters instead of asking for user input once ...
2
votes
0answers
60 views
Log all Google Chrome browser activity
This script documents every website visited and writes the text content of each webpage to its own individual file. It seems to work as intended. Is there anything I could do to improve it?
...
3
votes
1answer
65 views
Bash manual page selection menu
I wrote the following script in the hopes of streamlining the finding and reading of multiple manual pages. Since I am always looking up different utilities' manual pages I thought this would a good ...
1
vote
1answer
19 views
Pausing script while waiting for Docker container and printing updates
I'm looking to improve it in brevity, readability, and simplicity. Basically, I'm just looking for a more elegant solution. What improvements can I make?
...
1
vote
2answers
59 views
Iterating over a range of dates in a shell script
I have been working on a script that can be used to automatically pull the batch ids that were processed 4 days ago and which need to be processed tomorrow on the server. The batch IDs from 3 days ago ...
5
votes
1answer
56 views
`ls` indicates when directory is empty/full of dotfiles
I want ls to print a message when run on an empty or full of dotfiles directory. Instead of:
$ ls empty_dir/ dotfiles/
$
I ...
2
votes
1answer
51 views
Shell script to archive files to AWS S3
This is a simple script that moves files to S3 if they are > 14 days old. It ignores files that are < 14 days old. If the file is successfully synced to AWS S3 then we can remove it from the server....
2
votes
1answer
602 views
Shell script wrapper for Docker build and run
I have written a simple wrapper for docker build and docker run that allows me to build and run my image without having to use ...
2
votes
1answer
23 views
Shell command for the normal program termination of Skype from the command line
Would the following be the right way to do it in your opinion? Can you suggest a better alternative or, if not, is there something that can be done to make the existing version better?
...
4
votes
1answer
135 views
Raspberry Pi headless server using bash and USB automounting
Revised from: Bash scripts and udev rules to handle USB auto mounting / unmounting
Tested:
Uses USB insert/remove to control a headless Raspberry Pi 3 with Raspian Jessie Lite
Changes:
Implement ...
3
votes
1answer
91 views
Simple import system for a large shell program
I am writing a large shell program comprised of several source files. I was looking for a basic import system that accomplishes three goals.
Avoid sourcing entire files for access to just a few ...
3
votes
1answer
56 views
Shell script to display environment variables
This shell script writes my environment variables. If there is an argument, the shell script will grep for the argument in the environment variables.
...
1
vote
0answers
44 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
27 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. ...
2
votes
1answer
81 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
48 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
44 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
112 views
Install Ruby using rbenv in a bash script
I want to write an automated bash script for installing Ruby and Rails using rbenv, but I am getting session reload issues in the terminal.
...
2
votes
1answer
104 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
99 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
56 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
98 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
30 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
61 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
34 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
392 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
47 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
61 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.
...