Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shell]

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

3
votes
1answer
27 views

Bash program that sets up and configures the environment for new Debian installs

Here is my second version of a bash program I'm writing, as per @hjpotter92 I've updated and cleaned it since last: This script is run directly after a fresh install of Debian, to do: sets up ...
3
votes
2answers
33 views

Check that file is fully downloaded by FTP

I have a task in which I want to handle error occurred in FTP downloading, For which I used the wget command to download a file via FTP and once the download is ...
3
votes
1answer
62 views

Sleep until specified time

It's sometimes useful to pause until a specified time (but inconvenient to use at or the like), so I wrote a tiny script to wait until a user-specified time point ...
4
votes
0answers
35 views

Bash script to send notifications when low on ram

Backstory Recently, we've changed the PCs at my workplace to un Linux Mint. It works amazing, is blazing fast and the adjustment time was very short. However, I noticed my PC would freeze completely,...
3
votes
1answer
21 views

Git hook to detect existing tag case insensitive

In my company, we use git as VCS, the main server run under linux but all our code is for Windows and we all develop on Windows. The git tag system is case sensitive on linux but is case insensitive ...
0
votes
0answers
16 views

Avoiding incompatibility between Brew and Conda using a wrapper

Homebrew and Conda are known to not play well with each other. I like using both Brew and Conda, so I need a simple way to get them to work on the same system without breaking anything. In order to ...
5
votes
1answer
90 views

Bash script to setup new Debian installs

This script is run directly after a fresh install of Debian, to do: sets up syntax highlighting in nano, sets up iptables, sets ...
2
votes
1answer
37 views

File generator in shell script

I'm a student, and most of my lab work includes writing programs (usually .cpp) run them, copy the source code and output to a word file and either mail a pdf to the concerned teacher or submit in ...
2
votes
1answer
37 views

User-friendly script for searching through log files

A BASH script that ask users simple questions and greps the syslog archive files (plain-text and gzipped). The script is fully working; I am looking for advices on: Coding style Possible ...
0
votes
1answer
27 views

Commit the working directory to different branch and switch back

The aim of this script is to snapshot the current working directory of a git repository to another branch. Afterwards, it switches back to the original branch and restores the original state, ...
2
votes
1answer
40 views

Making a disk usage breakdown

I'm looking for a better way of doing this code I made. I work for tech support and one of the biggest questions I am asked is: "Hey, how did my disk get so full in my VPS?" I am aiming for output ...
5
votes
0answers
25 views

ffmpeg shell script to squeeze videos for Twitter

Here's a pretty rookie attempt at creating a shell script to squeeze videos into Twitter's 140s limitation: ...
3
votes
2answers
50 views

Bash script to rsync website

I'm new to bash scripting. I have pieced together a bash script to rsync my website files and databases. Any guidance on ways I could improve or make my script more secure would be greatly ...
7
votes
1answer
77 views

Squire for your recursive SSH adventures

One day I used to SSH to lots of machines to do some administrative tasks. I constantly used l to list directories just like I do on my own machines. Guess what, ...
7
votes
2answers
169 views

Copy files in parallel by reading what files to copy from few other files

I am working on a little complicated shell script for the first time and this is what it should do: During startup, it figures out what is my clientid by looking ...
3
votes
1answer
25 views

Creating charts for my UPS metrics - Part 2

Following up from my previous question Streaming my UPS metrics for graphical viewing in bash ...
3
votes
1answer
27 views

Streaming my UPS metrics for graphical viewing in bash

I have an APC UPS, which comes with the apcaccess utility to get various statistical values from the apcupsd daemon service. I ...
6
votes
1answer
66 views

Install Python script requirements

Sometimes I download a Python script (from a trusted source), and can't run it because of missing dependencies, which I have to install one by one (no ...
17
votes
2answers
994 views

Yet another shell in C

I wrote this shell in C about a semester ago for a university assignment on operating systems. Even though I got a score of 10/10 in this assignment, I doubt it deserved it - The pipeline ...
-1
votes
1answer
48 views

Legacy code: break in if block without a loop [closed]

I am a beginner in shell scripting and I am working on a legacy project where I need to maintain/enhance the shell scripts. I came across the following code block in a shell script. ...
3
votes
2answers
60 views

Moving files and leaving links in bash

The objective of this code is to create a command that move files and leaves links in their place. I'm just a beginner in shell scripting and it would be quite useful to hear your opinions on how to ...
4
votes
1answer
31 views

throwcatch: Super easy, SFTP-based backup tool

I've been working on a project for fun, it has reached a place of pretty decent stability and I would like to hear any and all criticisms you can find. The project basically enables admins to create ...
4
votes
1answer
105 views

OpenVPN Login Bash Shell script for DD-WRT router

This script is made to run on DD-WRT as I am running an OpenVPN server on it just to securely connect to my home network when I'm on the go. Basically, the input ($1...
2
votes
3answers
46 views

Shell install.sh for repository (rpi_videoloop)

I've written my first installation script in shell and was wondering on how I can improve the install procedure to make it more clean? Here's the code: ...
1
vote
0answers
25 views

Shell script to build executable from node.js

I'm trying ompile archive node.js executable into one executable using node-packer. For my all packages, executables of node.js ...
2
votes
1answer
24 views

Finding (and counting) duplicate JS/Java files

I have the following script which takes minutes to give output. ...
3
votes
2answers
42 views

Bash script for managing hashtag notes

I have written a simple script for managing hashtag notes. I am not familiar with bash scripting so I would really appreciate it if someone could give me some pointers about it. ...
11
votes
5answers
2k views

Git delete all merged in local branches

I have written a shell script utility for deleting all merged local branches. ...
3
votes
1answer
126 views

Reset files in Git which show as modified but have no changes according to “git diff”

This seems to be working but also is quite horrendously slow and seems a little hacky to me. ...
6
votes
1answer
74 views

Linux backup script shell

I wrote up script for backup of file system's log files, Please suggest me if any modification can be done on it for better working. (script) ...
4
votes
0answers
166 views

WSL LAMP stack script

The following code is aimed to establish a WSL based LAMP environment. This is instead XAMPP or WAMPP based LAMP environment which doesn't allow Bash. The script includes a cat heredocument called "...
2
votes
0answers
52 views

Shell script to manage passwords

To get my feet wet with shell scripting I wrote this "minimal command line password manager" (aka pwm) taking inspiration from the well known ...
4
votes
1answer
195 views

A basic Object Orientated REPL Implementation

Here is a very basic object orientated implementation of a read evaluate print loop AKA REPL. I encluded REShell to demonstrate how one could use ...
1
vote
1answer
74 views

Shell script to create a boilerplate proyect

This is actually my first shell script and just by looking at it I know this can look better. I use Elixir and Phoenix for most of my projects and I started using Zurb Foundation 6, changing from ...
3
votes
0answers
69 views

Colorized zsh prompt with support for Virtualenv and Git

I took the agnoster theme and re-wrote it to this: ...
2
votes
1answer
59 views

Bash script to validate a MySQL database

I am fairly new to bash script programming so I would love some feedback. I am trying to write a series of migration scripts for our DBs (please don't direct me to other tools; I spent a lot of time ...
7
votes
1answer
258 views

Basic shell in C

I'm new to C and created this shell to test my knowledge. It takes input from stdin, checks whether the full path has been given, if not, appends input to /bin/ and then executes. How can I improve; ...
1
vote
3answers
296 views

Shell script to parse variable definitions from Scala build file

The build.sbt text file contains versions like this: name := "happy" scalaVersion := "2.11.8" sparkVersion := "2.2.0" I wrote ...
3
votes
1answer
21 views

Accelerate set of sed commands in files (recursively over full directory)

I run this to fix some hard-coded references, replacing occurrences of mywar by clientwar: ...
3
votes
0answers
19 views

Compare timestamps of svgs versus exported pngs and export via Inkscape

This script goes through all svg files in an assets folder and compares them to the exported layers (one level above). If the svg timestamp is newer, it will automatically export the svg using ...
1
vote
2answers
46 views

BASH correct usage of single/double quotes when writing variables to file

(running Ubuntu 16.04.3) I created small script with tasks I do every time I upgrade/change Ubuntu version. One of the tasks is to write script to file, this is actual written file: ...
1
vote
1answer
47 views

Bash time converter

This is a simple script to convert a given unit of time to other units of time. I wrote this mainly to practice writing scripts that incorporate positional parameters. It actually turned out better ...
4
votes
1answer
27 views

Alternative to env that accepts arguments

It is commonly known that env does not allow passing of arguments - at least not reliably. There are various workarounds described here, but they felt to hacky and ...
8
votes
3answers
293 views

PS1 for Bash prompt showing last exit status, written mostly in Python

I had most of this functionality accomplished in BASH, but I was having trouble getting the last process's return value (even though I had a minimal working example). Plus, the escape codes made ...
2
votes
2answers
284 views

Run 'N' Number of PHP Scripts on shell forever in a loop

My objective is to run some 'N' number of PHP Scripts in cron. Since these are web scrapers coded in PHP and hits database on my server, each script runs for like 1 hour and they take a lot of CPU ...
3
votes
1answer
354 views

Bash script to deploy a mongodb cluster on local machine

I recently wrote a small script to deploy a mongodb cluster on a single machine. The cluster is composed of : 3 configurations server that holds the same informations (they are replicas ) 2 shard ...
9
votes
2answers
481 views

Memoizing or caching Bash function results

Update: I've implemented several of the features suggested below and packaged the improved code into a dedicated project: bash-cache . I display a number of expensive operations in my Bash prompt (e....
3
votes
3answers
78 views

Shell script to rebuild a Java webapp

I am asking for an experienced person to review my basic shell script. I do not write them at work, but I am a software developer. I am using this for my personal project that I am working on. Later, ...
1
vote
0answers
152 views

Reverse shell allows connection between computers

I've recently made a reverse-shell which allows you remote shell access to other computers. It's written in Python 2 and it is cross-platform. Basically, it get's user input for a command and sends ...
3
votes
1answer
73 views

Make cd command work with spaces

Some archives contain folders with spaces in their name. Sometimes while I'm browsing these folders, I want to open a terminal in current position, so I copy the path to paste it after a ...