Questions tagged [bash]

BASH is the GNU Bourne Again SHell, the successor to the classic Unix Bourne sh (shell). It's the default shell for various GNU systems.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

replace all multiple spaces and tabs to a single space only in a file

Is there a way to replace all multiple space and tabs in a file to single space only? I searched and so far I can only find the replacing multiple space: ...
4
votes
0answers
22 views

Shell script to download Project Euler problems and combine to PDF

This is a script I created that downloads Project Euler webpages and combines them to PDF. The script also downloads animated files. ...
3
votes
0answers
28 views

Recursively Copy Dotfiles from Git Repo to New System's Home Directory

I manage my dotfiles in a github repo. The idea would be that I could clone the repo if I ever have to develop on a new system and symlink them to the home ...
3
votes
1answer
61 views

Bash script to clone directory structure with renaming

I've written a script to aid in creating new watchfaces for the awesome AsteroidOS project. A watchface there typically consists of directory structure like this: ...
0
votes
0answers
25 views

Bash script for creating a list with largest files

I started scripting a 2 weeks ago and wrote a script which checks every sub directory until a certain level for the largest files. My question would be if I'm using the getopts correctly and/or if I ...
1
vote
1answer
85 views

Parse a selection of date formats

This Bash program parses day, month, year and month and year from arguments: ...
0
votes
1answer
36 views

Bash script to process Kafka messages

I want to use shell scripts to consume kafka messages and return to status. I found that my script wasn't efficient enough. Can I write this script better? I want to output kafka-console-consumer.sh ...
5
votes
1answer
40 views

Librarian script to find and copy a file

I wrote this script partly as an exercise in learning Bash and partly because I needed a tool to find specific versions of library files and copy them to a particular device. The script takes ...
2
votes
0answers
39 views

Fast git change sets with git wrapping scripts

After having a good experience with virtualenvwrapper built on top of the venv, I thought maybe it could be benefitial to have similar shortcuts for standard activities with git which could be time ...
0
votes
1answer
21 views

bash loop for checking service and network connection

I want to start omxplayer, check if there is the process is up, check if there is internet connection start with play a streaming, if there is not play a local loop, meanwhile try to check if the ...
3
votes
1answer
25 views

Bash argument parser with support for concatenated flags and '=' or ' ' between arguments and values

This is my best attempt so far at a bash script argument parser written without GNU getopt or bash getopts the first two ...
2
votes
2answers
48 views

Bash function to create a directory and change to it in a single command

I find myself frequently needing to create a new directory and changing to it enough to want to combine the two commands, so I figured it was a good opportunity to practice scripting with bash. The ...
3
votes
0answers
60 views

Bash script for pull-mode backups via restic's rest-server

I wrote the following Bash scripts to make pull-mode backups with restic, a backup solution written in Golang, similar to Borg Backup. The main use case for this script is pulling backups into a ...
4
votes
1answer
27 views

Ease process for gathering metadata from PDF, DJVU, EBOOK files

Learning Bash using hunt and peck method. Following code was put together from results of many "How do I ..." searches. Thus styling may be inconsistent. See code for my motivation. Any ...
1
vote
2answers
46 views

Colour message prettifier in Bash

Features: messages formatted with clear borders errors sent to stderr colour handling colours can be included in other strings echoed to the screen without having ...
2
votes
0answers
15 views

Reliable separation of Steam users

I wrote this bash script to try to make sure save games don't get mixed between different steam users using the same Ubuntu account. It uses inotify to try to figure out when a user changes and a soft ...
2
votes
1answer
41 views

bash function to "wrap" 7z

It appears that 7z can't write to a pipe, so I wrote the following bash function to emulate this functionality. I know this is a simple problem, but this is my first bash function and I feel like it's ...
1
vote
2answers
43 views

ds4mac - directory switcher for macOS/Linux: the installer script

In this post, I present the bash script for installing the ds4mac: ...
0
votes
0answers
22 views

ds4mac - directory switcher for macOS/Linux: the script

I have this program in GitHub. It is used for switching to directories via custom tags. Here is the main bash script: ...
2
votes
2answers
35 views

bash script to collect new network sockets in a given period of time

The following bash code is meant to check every second the amount of NEW (relative to the last second) network socket files. at the end of the run it summarizes every 60 entries (should be 60 seconds) ...
4
votes
3answers
56 views

Get popular Arch packages

Get a list of popular Arch Linux packages with a popularity greater or equal than the given one. It asks for the popularity if it isn't given. Then gets the total number of packages and iterates until ...
0
votes
1answer
51 views

Uncompress files, with autodetection of algorithm

Hi Everyone, this is my first bash script ever. I would really appreciate it if you could provide me with some comments and insights regarding correct function use, logic implementation, and a lead to ...
0
votes
1answer
28 views

Handling field separator option

Have been constructing an array that can be used to populate options to find. ${incl[@]} made from function parameter arguments that takes filename suffixes. ...
4
votes
0answers
33 views

Shell script to backup local files to public cloud

This is a script that I've written for personal use, and to educate myself. The script is a bit comment heavy to help future me remember all the details & design choices made at the time of ...
0
votes
0answers
19 views

Bash function with dry-run and exec options

Am writing a bash function to run rsync, with possibility of using --dry-run option and ...
3
votes
1answer
98 views

Compiling and running a program to generate fractal images

I'm making images. My steps are: create PGM files using a C program convert/resize PGM to PNG using Image Magic remove (big) PGM files To do it I use Make and a Bash script. The Makefile is very ...
1
vote
0answers
24 views

Is this docker entrypoint bash script for passing parameters to the containerized app 'good'?

Source code located here I am trying to pass extra parameters from a container to the contained application. The following bash script is working to pass extra variables, but I'm not sure that it's ...
4
votes
1answer
46 views

Extracting domains and IPs from Exodus trackers JSON report

The following command series is used to gather every bit of valuable information from Exodus trackers. The ultimate goal would be to get this all into one jq ...
3
votes
2answers
30 views

Test harness that uses server process

I have a test suite that queries a localhost-based server. The server process needs to be running in order for the server to work. The process may be running already for debugging work, but it might ...
5
votes
2answers
365 views

Bash partitioning script

What can I improve in this script? Do I read user's yes/no answers by right way? Should I write bash scripts so that to be compatible with POSIX? ...
4
votes
1answer
106 views

Generating a domain and IP blacklist with Bash

This is a project to pull domain & IP blacklists from various sources and compile them into one list. There are some whitelists included that are applied when a blacklist is built. It draws ...
1
vote
2answers
48 views

Installing packages if they don't exist in Bash

This script simply installs the chosen packages if they're not present on a Linux system using the apt package manager. Notes on improvements of any aspect are ...
6
votes
3answers
688 views

Updating text in a HTML document with Bash

This is a small script to update my project's README file. Notes on improvements from any aspect are welcome! Here is the document it updates. readme.sh (Executed like so: ./readme.sh) ...
4
votes
2answers
184 views

Linux backup script written in bash for tar

This is my first attempt at scripting with bash. I am running Ubuntu server, so I don't get to use all the gui back ups out there. Besides, tar works fine for personal use. Please let me know of any ...
2
votes
0answers
48 views

The Blacklist v2

This script gathers domains listed from sources in this JSON file and compiles them into one text file. Text files that have a similar key under the whitelists ...
1
vote
2answers
91 views

Bash script (to be used as a login MOTD message) that displays status of docker-compose projects, and individual docker containers

This is for a cheap VPS I use for personal projects. I like having a message of the day displaying system info on login; I wanted to add the status of my docker containers to it, to see if all are ...
1
vote
1answer
29 views

Testable and self-contained bash script

I wrote a short bash script for a completion check of downloading images. goal of this code (Added) I have some downloading content directories. Each of them has a script for downloading images(...
3
votes
1answer
58 views

Parse log file and send the result to an API

The task is to get the most recent login time of the day for each user. Then send such a result to an API. The log file (file.log) looks like the following (only ...
3
votes
3answers
307 views

Bash script using rsync to backup (another one)

I created a backup script in bash to basically backup my webservers using cron commands. The script reads one or multiple config file(s), downloads a target directory, and can send by mail the rsync ...
3
votes
1answer
59 views

The Blacklist: Blocking Malicious domains using Bash

I've made this script to automate blocking some deviant hosts on my router, and was curious if there's anything much else that can be done to make it quicker and more efficient. Presently I'm ...
1
vote
1answer
38 views

Bash script syncronizing yaml and asciidoc headers using sed

I have a bash script that fixes or creates, and syncs the asciidoc attributes and yaml header for blog posts. It does what it is supposed to. But notice I have put ...
3
votes
2answers
100 views

Wrapper to mount partition before launching executable

Solved task is pretty straightforward: mounting partition if not mounted already, to start executable. There is a couple of checks and notifications because it is supposed to be launched from X and ...
0
votes
1answer
58 views

Watch for file changes in Linux

I have installed Geekworm x735 on my Raspberry Pi, it uses the script below with an infinite loop to determine if the power button has been pressed. I know there are some Linux utils that watch for ...
1
vote
1answer
32 views

Rdoc - a command-line tool for launching documents (improved)

A few days ago I posted a previous version of my first bash script here to get few tips and reviews so I could improve it. So now it is improved a bit. I also shellchecked it and fixed the warnings. I ...
2
votes
0answers
31 views

bash / awk workflow operating on multi-column files [closed]

I am working on the improvement of the bash-awk workflow designed for the analysis of data in multiple-colums format. The script uses AWK code (which extract numbers from selected columns of the input....
0
votes
1answer
82 views

Bash script that helps in opening documents when using terminal

I just finished creating my first bash script that helps me to launch documents from terminal using a pdf viewer. This is very helpful and fast (at least I think so) for people who don't use any files ...
1
vote
1answer
161 views

Bash script for mounting and backing up VeraCrypt volumes

My bash script mounts two VeraCrypt volumes, rsyncs their contents, and dismounts them. The script takes two parameters, the path for both the source and backup veracrypt volumes. I wrote this script ...
1
vote
0answers
25 views

Printing of status message during execution of the bash script

As a part of my bash routine I am printing some message in terminal regarding status of the workflow. The message in splited into two parts (part 1: begining of the task, part 2: status of its ...
0
votes
0answers
13 views

Short bash script to join arguments with dashoption, escaping quotes and $ dollar sign

So I got this short awk invocation wrapped in a bash script. unfortunately the bash script is kinda unreadable. Do you have any pointers? ...
2
votes
1answer
47 views

Bash: call make when directory changes

I usually like to use entr when developing on my own hardware to run commands when a directory changes. However, sometimes I'm working in an environment where I don'...

1
2 3 4 5
16