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
2
votes
2answers
47 views

How long a PID has been running (taking multiple inputs)

Tonight I tried to write a POSIX shell script which would allow me to check how long a process is running (via it's ID) and be able to handle multiple inputs: ...
2
votes
2answers
119 views

Shell command to output all plugins that exist across multiple wordpress installations

I'm working on a server and need a complete list of plugins that are installed for all wp installations. I only need to know whether a plugin exists or not, it doesn't matter where it exists. For ...
2
votes
1answer
77 views

Random password generator sh script

Yesterday, I was bored and decided to write a random password generator. At first it used numerous temporary files, changed that by using arrays. This was written on OS X and should work on Linux ...
2
votes
2answers
41 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
67 views

POSIX shell function to “dump” all given arguments

My today's idea was to create a POSIX shell function to dump all given arguments, typical use would be to call it from a fucntion, where you already know some arguments are not well set (empty; not ...
2
votes
1answer
51 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
0answers
28 views

sh script to open related URL based on possible nicknames

I'm new to sh and I would like to get feedback on how I can improve my code. The purpose is simple; I want to open the Jenkins JOB related to a service based on its possible aliases. If I map a ...
2
votes
0answers
15 views

Re-interpolating a value from jq back into jq

I have an almost-json document in a file named "versions.json" like this: ...
2
votes
0answers
42 views

Outputting a standalone shell script from arguments

I am solving an exercise. Essentially, it's a shell script that takes in file and/or directory arguments and outputs another (standalone) shell script that outputs these files, including any directory ...
2
votes
0answers
44 views

Code to backup the history file in Linux

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file; I just wrote it and I've tested it and it almost works. This was the ...
2
votes
0answers
62 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 ...
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 ...
1
vote
2answers
84 views

Editing system files in Linux (as root) with GUI and CLI text editors #2 (final)

This is the second iteration of this question A note to start with: the first iteration of this question can be found here: Editing system files in Linux (as root) with GUI and CLI text editors As ...
1
vote
1answer
84 views

Bash Code to backup the history file in Linux [closed]

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file, I just wrote it. The code is supposed to do this: Backup my ...
1
vote
2answers
172 views

Long-term archiving + encrypting shell script

Yesterday, I very quickly, in an hour, wrote the very first version of my long-term archiving + encrypting shell script. I am aware it may have too many flaws, but none of them really prevent it from ...
1
vote
1answer
266 views

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

As root, run: ...
1
vote
1answer
104 views

Shell POSIX OpenSSL file decryption script follow-up #1

This question is the first follow-up of: Shell POSIX OpenSSL file decryption script Please read it before you continue reading this. Thank you. I only have one new problem solved and I would like ...
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. ...
1
vote
0answers
37 views

sudoedit_enhanced written POSIX-ly (readlink possible problem?)

sudoedit_enhanced written POSIX-ly challenge While creating sudoedit_enhanced POSIX (apart from ...
1
vote
0answers
38 views

Interactive Linux upgrade script - Follow-up #1

One year ago I asked for a yearly revision of my Interactive Linux upgrade script. There is nothing new to the conditions, therefore please read the original question before you decide to comment and ...
0
votes
1answer
49 views

Shell POSIX OpenSSL file decryption script follow-up #2

This question is the second follow-up of: Shell POSIX OpenSSL file decryption script The first follow-up was: Shell POSIX OpenSSL file decryption script follow-up #1 Both of which have proven very ...
0
votes
1answer
29 views

Shell POSIX OpenSSL file decryption script follow-up #3 (final)

From original very simplistic code: Shell POSIX OpenSSL file decryption script I learned a lot both from the first follow-up review, and the second one as well, many thanks! I just need one final ...
0
votes
1answer
330 views

POSIX shell script for generating pseudo-random numbers

My today's goal was to further practice POSIX shell scripting. So, I decided to write the following POSIX shell script for generating pseudo-random numbers. Any and all reviews would be appreciated. ...

1
2