Questions tagged [sh]

sh, aka Bourne Shell, is the Unix Shell, the standard shell since v7 Unix. POSIX has standardized the shell, and portable shell scripts should conform to /bin/sh syntax.

Filter by
Sorted by
Tagged with
5
votes
1answer
38 views

Script to record an inventory of a backup

This is a script designed to make an inventory file which records the contents of a directory allowing verification that a backup has the same data. The same script can also A full github repo is ...
4
votes
1answer
107 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 ...
1
vote
1answer
265 views

Disable reboot on control-alt-delete for RedHat/CentOS 5/6/7

As root, run: ...
3
votes
1answer
32 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
126 views

POSIX shell script using a string to store command arguments

Background I’ve started putting all my configuration files (which include many shell files) under version control. In the Git repository, I’ve configured a pre-commit hook that runs the ...
1
vote
1answer
112 views

Sh script to reduce version number in opkg status file

I have written a script to reduce/lower the version number stored in opkg status file using small shell script, This will enable us to force the opkg to install same version of a Debian package again. ...
6
votes
2answers
70 views

An installer for shell scripts, written in pure sh

I wrote a tiny shell script that basically installs a script into your system by copying it to someplace like /usr/local/bin, chmodding it, and adding it to your ...
2
votes
2answers
55 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 ...
10
votes
1answer
124 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
123 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 it'...
9
votes
2answers
740 views

Fizz having an argument with Buzz

For my current project I need to validate responses. The requests will be send from multiple different shell scripts and should be controlled from another script. I'd never targeted a ...
4
votes
3answers
710 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 ...
3
votes
1answer
710 views

Bash script that checks for package dependencies and installs them if necessary

I'm new to writing bash scripts and 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 package exists using ...
3
votes
1answer
189 views

A minimal init script

I tried looking up some good example init scripts, but all that I found were excessively complicated. So I wrote my own simple init script targeting CentOS 6. I tried to follow LSB where I understood ...
6
votes
3answers
2k 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, ...
6
votes
2answers
141 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. ...
2
votes
0answers
107 views

Script to configure Synaptics touchpad

I have a shell script to configure Synaptics touchpad settings at login. Background You configure the touchpad with the synclient command. Its usage is ...
4
votes
1answer
165 views

Shell script for creating CR questions

Inspired by Tool for creating CodeReview 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 stdout:...
7
votes
3answers
176 views

Shell Script Image Replication

I have a shell script which is being used on an embedded human machine interface (HMI). This script is used to copy a few files from a USB stick to a different place on the device, but with multiple ...
8
votes
2answers
8k views

Shell script to assist with branch management for tasks in git

I found nvie's git branching model simple enough to grasp and suitable for my projects - but the frontend supplied at GitHub was far too complex for me to understand. Hence, I wrote this script to ...
4
votes
1answer
220 views

Mount different remote systems

I have a shell script to mount different remote systems. While it does work, the area I struggle with (not being a programmer) is the logic of the script: it feels quite stilted and there seems to be ...
4
votes
3answers
385 views

Shell script to sync dotfiles repository

I'm doing the git dot files thing and created a script -- my first Unix shell script -- to synchronise the repo dot files with those in the user's home. It checks which dot files exist in the repo ...
7
votes
5answers
982 views

Shell script to download and extract a tarball from GitHub

I don't want anything to execute if any preceding step fails: ...

1
2